aboutsummaryrefslogtreecommitdiff
path: root/test/org/traccar
diff options
context:
space:
mode:
Diffstat (limited to 'test/org/traccar')
-rw-r--r--test/org/traccar/ProtocolTest.java17
-rw-r--r--test/org/traccar/protocol/Gps103ProtocolDecoderTest.java4
2 files changed, 18 insertions, 3 deletions
diff --git a/test/org/traccar/ProtocolTest.java b/test/org/traccar/ProtocolTest.java
index 939b3bd2c..1b5c0ea00 100644
--- a/test/org/traccar/ProtocolTest.java
+++ b/test/org/traccar/ProtocolTest.java
@@ -84,7 +84,7 @@ public class ProtocolTest extends BaseTest {
assertNotNull(decoder.decode(null, null, object));
}
- protected void verifyNull(Object object) throws Exception {
+ protected void verifyNull(Object object) {
assertNull(object);
}
@@ -93,7 +93,18 @@ public class ProtocolTest extends BaseTest {
}
protected void verifyAttribute(BaseProtocolDecoder decoder, Object object, String key, Object expected) throws Exception {
- assertEquals(expected, ((Position) decoder.decode(null, null, object)).getAttributes().get(key));
+ Position position = (Position) decoder.decode(null, null, object);
+ switch (key) {
+ case "speed":
+ assertEquals(expected, position.getSpeed());
+ break;
+ case "course":
+ assertEquals(expected, position.getCourse());
+ break;
+ default:
+ assertEquals(expected, position.getAttributes().get(key));
+ break;
+ }
}
protected void verifyAttributes(BaseProtocolDecoder decoder, Object object) throws Exception {
@@ -291,7 +302,7 @@ public class ProtocolTest extends BaseTest {
}
protected void verifyCommand(
- BaseProtocolEncoder encoder, Command command, ByteBuf expected) throws Exception {
+ BaseProtocolEncoder encoder, Command command, ByteBuf expected) {
verifyFrame(expected, encoder.encodeCommand(command));
}
diff --git a/test/org/traccar/protocol/Gps103ProtocolDecoderTest.java b/test/org/traccar/protocol/Gps103ProtocolDecoderTest.java
index b44eb26f9..da8d8ff5a 100644
--- a/test/org/traccar/protocol/Gps103ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/Gps103ProtocolDecoderTest.java
@@ -11,6 +11,10 @@ public class Gps103ProtocolDecoderTest extends ProtocolTest {
Gps103ProtocolDecoder decoder = new Gps103ProtocolDecoder(null);
+ verifyAttribute(decoder, text(
+ "imei:868683023212255,tracker,190205084503,,F,064459.000,A,4915.1221,N,01634.5655,E,3.91,83.95;"),
+ "course", 83.95);
+
verifyPosition(decoder, text(
"imei:864180034124375,vt14,190116192753,,F,172750.000,A,3649.2186,N,00235.8411,W,0.00,0,,0,0,51.93%,,+22;"));