diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/org/traccar/ProtocolDecoderTest.java | 9 | ||||
-rw-r--r-- | test/org/traccar/protocol/Tlt2hProtocolDecoderTest.java | 3 |
2 files changed, 11 insertions, 1 deletions
diff --git a/test/org/traccar/ProtocolDecoderTest.java b/test/org/traccar/ProtocolDecoderTest.java index 564ecb751..61c333d67 100644 --- a/test/org/traccar/ProtocolDecoderTest.java +++ b/test/org/traccar/ProtocolDecoderTest.java @@ -74,6 +74,15 @@ 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); + for (Object item : (List) decodedObject) { + verifyDecodedPosition(item, position); + } + } + protected Position position(String time, boolean valid, double lat, double lon) throws ParseException { Position position = new Position(); diff --git a/test/org/traccar/protocol/Tlt2hProtocolDecoderTest.java b/test/org/traccar/protocol/Tlt2hProtocolDecoderTest.java index b0f90a82d..70515cf00 100644 --- a/test/org/traccar/protocol/Tlt2hProtocolDecoderTest.java +++ b/test/org/traccar/protocol/Tlt2hProtocolDecoderTest.java @@ -12,7 +12,8 @@ public class Tlt2hProtocolDecoderTest extends ProtocolDecoderTest { verifyPositions(decoder, text( "#357671030946351#V500#0000#AUTO#1\r\n", - "#$GPRMC,223835.000,A,0615.3545,S,10708.5779,E,14.62,97.41,070313,,,D*70\r\n")); + "#$GPRMC,223835.000,A,0615.3545,S,10708.5779,E,14.62,97.41,070313,,,D*70\r\n"), + position("2013-03-07 22:38:35.000", true, -6.25591, 107.14297)); verifyPositions(decoder, text( "\r\n#357671030946351#V500#0000#AUTO#1\r\n", |