diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2019-02-05 18:53:49 -0800 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2019-02-05 18:53:49 -0800 |
commit | 9cd715dffe8efdcb6c3e87fa56e1c67f7cd870d5 (patch) | |
tree | 2a30b05aba8cb48d6e7a607b3c155d63a022037f /test/org/traccar/ProtocolTest.java | |
parent | 6810c4c75fd2f7c388b0b8058f6c327ae15ca53e (diff) | |
download | trackermap-server-9cd715dffe8efdcb6c3e87fa56e1c67f7cd870d5.tar.gz trackermap-server-9cd715dffe8efdcb6c3e87fa56e1c67f7cd870d5.tar.bz2 trackermap-server-9cd715dffe8efdcb6c3e87fa56e1c67f7cd870d5.zip |
Fix GPS103 course decoding
Diffstat (limited to 'test/org/traccar/ProtocolTest.java')
-rw-r--r-- | test/org/traccar/ProtocolTest.java | 17 |
1 files changed, 14 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)); } |