aboutsummaryrefslogtreecommitdiff
path: root/test/net/sourceforge/opentracking/protocol/gps103/Gps103ProtocolDecoderTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'test/net/sourceforge/opentracking/protocol/gps103/Gps103ProtocolDecoderTest.java')
-rw-r--r--test/net/sourceforge/opentracking/protocol/gps103/Gps103ProtocolDecoderTest.java41
1 files changed, 11 insertions, 30 deletions
diff --git a/test/net/sourceforge/opentracking/protocol/gps103/Gps103ProtocolDecoderTest.java b/test/net/sourceforge/opentracking/protocol/gps103/Gps103ProtocolDecoderTest.java
index 0e99a8637..18fde11a7 100644
--- a/test/net/sourceforge/opentracking/protocol/gps103/Gps103ProtocolDecoderTest.java
+++ b/test/net/sourceforge/opentracking/protocol/gps103/Gps103ProtocolDecoderTest.java
@@ -30,42 +30,23 @@ public class Gps103ProtocolDecoderTest {
@Test
public void testDecode() throws Exception {
-
- Calendar time = new GregorianCalendar(TimeZone.getTimeZone("UTC"));
- time.set(Calendar.HOUR, 0);
- time.set(Calendar.MINUTE, 1);
- time.set(Calendar.SECOND, 2);
- time.set(Calendar.MILLISECOND, 3);
- String x = time.getTime().toString();
-
- String testMsg1 = "##,imei:10000000000000,A";
- // NEW MESSAGE: imei:359587017470280,tracker,0000000000,03184511405,L,;
-
- String testMsg2 = //"imei:10000000000000,help me,1004171910,,F,010203.000,A,0102.0003,N,00102.0003,E,1.02,";
- //"imei:353451040164707,tracker,1105182344,+36304665439,F,214418.000,A,4804.2222,N,01916.7593,E,0.37,";
- //"imei:353451042861763,tracker,1106132241,, F,144114.000,A,2301.9052,S,04909.3676,W,0.13,";
- "imei:359587010124900,tracker,0809231929,13554900601,F,112909.397,A,2234.4669,N,11354.3287,E,0.11,321.53,;";
-
+
Gps103ProtocolDecoder decoder = new Gps103ProtocolDecoder(new TestDataManager(), 0);
- //assertNull(decoder.decode(null, null, testMsg1));
- Position position = (Position) decoder.decode(null, null, testMsg2);
-
- //Date time = new GregorianCalendar(2003, 1, 1, 1, 2, 3).getTime();
- //assertEquals(time, position.getTime());
+
+ // assertNull(decoder.decode(null, null, "##,imei:10000000000000,A"));
- assertEquals(true, position.getValid());
+ assertNotNull(decoder.decode(null, null,
+ "imei:10000000000000,help me,1004171910,,F,010203.000,A,0102.0003,N,00102.0003,E,1.02,"));
- Double latitude = 1.0 + 2.0003 / 60.0;
- assertEquals(latitude, position.getLatitude());
+ assertNotNull(decoder.decode(null, null,
+ "imei:353451040164707,tracker,1105182344,+36304665439,F,214418.000,A,4804.2222,N,01916.7593,E,0.37,"));
- Double longitude = 1.0 + 2.0003 / 60.0;
- assertEquals(longitude, position.getLongitude());
+ assertNotNull(decoder.decode(null, null,
+ "imei:353451042861763,tracker,1106132241,,F,144114.000,A,2301.9052,S,04909.3676,W,0.13,"));
- Double speed = 1.02;
- assertEquals(speed, position.getSpeed());
+ assertNotNull(decoder.decode(null, null,
+ "imei:359587010124900,tracker,0809231929,13554900601,F,112909.397,A,2234.4669,N,11354.3287,E,0.11,321.53,;"));
- Long deviceId = new Long(1);
- assertEquals(deviceId, position.getDeviceId());
}
}