aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2017-05-20 11:18:17 +1200
committerGitHub <noreply@github.com>2017-05-20 11:18:17 +1200
commit6879624fd6290eea9a7f45047ba089ee1435d3ce (patch)
tree5e7de0a5669fb22af0bd3d2b70a5847113d37f80 /test
parentf523e3b995f5f1895cf3dea700be34f4b74dccf9 (diff)
parentab46ebf23066f91369b0d037f273bed1ea814d82 (diff)
downloadtraccar-server-6879624fd6290eea9a7f45047ba089ee1435d3ce.tar.gz
traccar-server-6879624fd6290eea9a7f45047ba089ee1435d3ce.tar.bz2
traccar-server-6879624fd6290eea9a7f45047ba089ee1435d3ce.zip
Merge pull request #3174 from Abyss777/battery_level
Adjust battery and batteryLevel type
Diffstat (limited to 'test')
-rw-r--r--test/org/traccar/ProtocolTest.java9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/org/traccar/ProtocolTest.java b/test/org/traccar/ProtocolTest.java
index 1725e31be..c9d4ceeb2 100644
--- a/test/org/traccar/ProtocolTest.java
+++ b/test/org/traccar/ProtocolTest.java
@@ -192,6 +192,15 @@ 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)) {
+ int batteryLevel = ((Number) attributes.get(Position.KEY_BATTERY_LEVEL)).intValue();
+ Assert.assertTrue(batteryLevel <= 100 && batteryLevel >= 0);
+ }
+
if (position.getNetwork() != null && position.getNetwork().getCellTowers() != null) {
for (CellTower cellTower : position.getNetwork().getCellTowers()) {
checkInteger(cellTower.getMobileCountryCode(), 0, 999);