diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-10-30 17:03:51 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-10-30 17:03:51 +1300 |
commit | 6cec14dfbbf59e14efd43ab147e70b9f5803aec5 (patch) | |
tree | 7a4ec847120825343917ff7d22edd27a53dc37da | |
parent | b14974fec3c529e4cc29db6f86372efddc87b959 (diff) | |
download | trackermap-server-6cec14dfbbf59e14efd43ab147e70b9f5803aec5.tar.gz trackermap-server-6cec14dfbbf59e14efd43ab147e70b9f5803aec5.tar.bz2 trackermap-server-6cec14dfbbf59e14efd43ab147e70b9f5803aec5.zip |
Add Megastek unit test case
-rw-r--r-- | src/org/traccar/protocol/MegastekProtocolDecoder.java | 2 | ||||
-rw-r--r-- | test/org/traccar/ProtocolDecoderTest.java | 9 | ||||
-rw-r--r-- | test/org/traccar/protocol/MegastekProtocolDecoderTest.java | 3 |
3 files changed, 12 insertions, 2 deletions
diff --git a/src/org/traccar/protocol/MegastekProtocolDecoder.java b/src/org/traccar/protocol/MegastekProtocolDecoder.java index fd6b2be83..2de63b15a 100644 --- a/src/org/traccar/protocol/MegastekProtocolDecoder.java +++ b/src/org/traccar/protocol/MegastekProtocolDecoder.java @@ -1,5 +1,5 @@ /* - * Copyright 2013 - 2014 Anton Tananaev (anton.tananaev@gmail.com) + * Copyright 2013 - 2015 Anton Tananaev (anton.tananaev@gmail.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/test/org/traccar/ProtocolDecoderTest.java b/test/org/traccar/ProtocolDecoderTest.java index e52ea4695..df8eb4e10 100644 --- a/test/org/traccar/ProtocolDecoderTest.java +++ b/test/org/traccar/ProtocolDecoderTest.java @@ -154,6 +154,15 @@ public class ProtocolDecoderTest { Assert.assertEquals("latitude", expected.getLatitude(), position.getLatitude(), 0.00001); Assert.assertEquals("longitude", expected.getLongitude(), position.getLongitude(), 0.00001); + Assert.assertTrue("altitude >= -12262", position.getAltitude() >= -12262); + Assert.assertTrue("altitude <= 18000", position.getAltitude() <= 18000); + + Assert.assertTrue("speed >= 0", position.getSpeed() >= 0); + Assert.assertTrue("speed <= 869", position.getSpeed() <= 869); + + Assert.assertTrue("course >= 0", position.getCourse() >= 0); + Assert.assertTrue("course <= 360", position.getCourse() <= 360); + } private void verifyDecodedPosition(Object decodedObject) { diff --git a/test/org/traccar/protocol/MegastekProtocolDecoderTest.java b/test/org/traccar/protocol/MegastekProtocolDecoderTest.java index 4ccf2a7e0..9046b3928 100644 --- a/test/org/traccar/protocol/MegastekProtocolDecoderTest.java +++ b/test/org/traccar/protocol/MegastekProtocolDecoderTest.java @@ -11,7 +11,8 @@ public class MegastekProtocolDecoderTest extends ProtocolDecoderTest { MegastekProtocolDecoder decoder = new MegastekProtocolDecoder(new MegastekProtocol()); verifyPosition(decoder, text( - "$MGV002,860719020193193,DeviceName,R,240214,104742,A,2238.20471,N,11401.97967,E,00,03,00,1.20,0.462,356.23,137.9,1.5,460,07,262C,0F54,25,0000,0000,0,0,0,28.5,28.3,,,100,Timer;!")); + "$MGV002,860719020193193,DeviceName,R,240214,104742,A,2238.20471,N,11401.97967,E,00,03,00,1.20,0.462,356.23,137.9,1.5,460,07,262C,0F54,25,0000,0000,0,0,0,28.5,28.3,,,100,Timer;!"), + position("2014-02-24 10:47:42.000", true, 22.63675, 114.03299)); verifyPosition(decoder, text( "STX2010101801 j$GPRMC,101053.000,A,2232.7607,N,11404.7669,E,0.00,,231110,,,A*7F,460,00,2795,0E6A,14,94,1000,0000,91,Timer;1D")); |