aboutsummaryrefslogtreecommitdiff
path: root/test/org/traccar/ProtocolDecoderTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'test/org/traccar/ProtocolDecoderTest.java')
-rw-r--r--test/org/traccar/ProtocolDecoderTest.java23
1 files changed, 18 insertions, 5 deletions
diff --git a/test/org/traccar/ProtocolDecoderTest.java b/test/org/traccar/ProtocolDecoderTest.java
index e52ea4695..133b0229f 100644
--- a/test/org/traccar/ProtocolDecoderTest.java
+++ b/test/org/traccar/ProtocolDecoderTest.java
@@ -38,7 +38,7 @@ public class ProtocolDecoderTest {
}
@Override
- public Device getDeviceByUniqueId(String imei) {
+ public Device getDeviceByUniqueId(String uniqueId) {
return createDevice();
}
@@ -67,8 +67,8 @@ public class ProtocolDecoderTest {
protected void verifyPositions(BaseProtocolDecoder decoder, Object object) throws Exception {
Object decodedObject = decoder.decode(null, null, object);
- Assert.assertNotNull(decodedObject);
- Assert.assertTrue(decodedObject instanceof List);
+ Assert.assertNotNull("list is null", decodedObject);
+ Assert.assertTrue("not a list", decodedObject instanceof List);
Assert.assertFalse("list if empty", ((List) decodedObject).isEmpty());
for (Object item : (List) decodedObject) {
verifyDecodedPosition(item);
@@ -77,8 +77,8 @@ public class ProtocolDecoderTest {
protected void verifyPositions(BaseProtocolDecoder decoder, Object object, Position position) throws Exception {
Object decodedObject = decoder.decode(null, null, object);
- Assert.assertNotNull(decodedObject);
- Assert.assertTrue(decodedObject instanceof List);
+ Assert.assertNotNull("list is null", decodedObject);
+ Assert.assertTrue("not a list", decodedObject instanceof List);
Assert.assertFalse("list if empty", ((List) decodedObject).isEmpty());
for (Object item : (List) decodedObject) {
verifyDecodedPosition(item, position);
@@ -154,6 +154,17 @@ public class ProtocolDecoderTest {
Assert.assertEquals("latitude", expected.getLatitude(), position.getLatitude(), 0.00001);
Assert.assertEquals("longitude", expected.getLongitude(), position.getLongitude(), 0.00001);
+ Assert.assertTrue("altitude >= -12262", position.getAltitude() >= -12262);
+ Assert.assertTrue("altitude <= 18000", position.getAltitude() <= 18000);
+
+ Assert.assertTrue("speed >= 0", position.getSpeed() >= 0);
+ Assert.assertTrue("speed <= 869", position.getSpeed() <= 869);
+
+ Assert.assertTrue("course >= 0", position.getCourse() >= 0);
+ Assert.assertTrue("course <= 360", position.getCourse() <= 360);
+
+ Assert.assertNotNull("protocol is null", position.getProtocol());
+
}
private void verifyDecodedPosition(Object decodedObject) {
@@ -183,6 +194,8 @@ public class ProtocolDecoderTest {
Assert.assertTrue("course >= 0", position.getCourse() >= 0);
Assert.assertTrue("course <= 360", position.getCourse() <= 360);
+ Assert.assertNotNull("protocol is null", position.getProtocol());
+
}
}