diff options
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)); } |