diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-10-28 13:51:58 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-10-28 13:51:58 +1300 |
commit | 6e594f07b8f1236e000952601ce2d6ff7aa0575a (patch) | |
tree | 2d5181b90032762bef6e5789562e785b5598dea9 /test/org/traccar | |
parent | ba1ce052ba5ed33a1110448f5857e8e7e2e101d0 (diff) | |
download | traccar-server-6e594f07b8f1236e000952601ce2d6ff7aa0575a.tar.gz traccar-server-6e594f07b8f1236e000952601ce2d6ff7aa0575a.tar.bz2 traccar-server-6e594f07b8f1236e000952601ce2d6ff7aa0575a.zip |
Refactor TLT-2H protocol decoder
Diffstat (limited to 'test/org/traccar')
-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", |