From 9e758d437c048b954d224935664b76d6f6f8416c Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Fri, 19 May 2017 14:41:23 +0500 Subject: Adjust battery and batteryLevel type --- test/org/traccar/ProtocolTest.java | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'test/org/traccar') diff --git a/test/org/traccar/ProtocolTest.java b/test/org/traccar/ProtocolTest.java index 1725e31be..94c5edb9f 100644 --- a/test/org/traccar/ProtocolTest.java +++ b/test/org/traccar/ProtocolTest.java @@ -192,6 +192,16 @@ public class ProtocolTest extends BaseTest { Assert.assertTrue(attributes.get(Position.KEY_FUEL_LEVEL) instanceof Number); } + if (attributes.containsKey(Position.KEY_BATTERY)) { + Assert.assertTrue(attributes.get(Position.KEY_BATTERY) instanceof Number); + } + + if (attributes.containsKey(Position.KEY_BATTERY_LEVEL)) { + Object batteryLevel = attributes.get(Position.KEY_BATTERY_LEVEL); + Assert.assertTrue(batteryLevel instanceof Number); + Assert.assertTrue(((Number) batteryLevel).intValue() <=100 && ((Number) batteryLevel).intValue() >= 0); + } + if (position.getNetwork() != null && position.getNetwork().getCellTowers() != null) { for (CellTower cellTower : position.getNetwork().getCellTowers()) { checkInteger(cellTower.getMobileCountryCode(), 0, 999); -- cgit v1.2.3