diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2013-11-09 19:01:19 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2013-11-09 19:01:19 +1300 |
commit | cf0565caceee6856328e481dd23600ed2590c88a (patch) | |
tree | 9d2cc8cf8d3eb27b36412eb492ad702581891f1c | |
parent | f9ecee5b732b0c82c8a95bebdb5e275ea479cccc (diff) | |
download | traccar-server-cf0565caceee6856328e481dd23600ed2590c88a.tar.gz traccar-server-cf0565caceee6856328e481dd23600ed2590c88a.tar.bz2 traccar-server-cf0565caceee6856328e481dd23600ed2590c88a.zip |
Improve unit test verification
69 files changed, 528 insertions, 392 deletions
diff --git a/src/org/traccar/protocol/EnforaProtocolDecoder.java b/src/org/traccar/protocol/EnforaProtocolDecoder.java index 3d8d3221a..e5e5680d9 100644 --- a/src/org/traccar/protocol/EnforaProtocolDecoder.java +++ b/src/org/traccar/protocol/EnforaProtocolDecoder.java @@ -1,5 +1,5 @@ /* - * Copyright 2012 Anton Tananaev (anton.tananaev@gmail.com) + * Copyright 2012 - 2013 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. @@ -27,24 +27,16 @@ import org.traccar.BaseProtocolDecoder; import org.traccar.ServerManager; import org.traccar.helper.ChannelBufferTools; import org.traccar.helper.Log; +import org.traccar.model.ExtendedInfoFormatter; import org.traccar.model.Position; -/** - * Enfora protocol decoder - */ public class EnforaProtocolDecoder extends BaseProtocolDecoder { - /** - * Initialize - */ public EnforaProtocolDecoder(ServerManager serverManager) { super(serverManager); } - /** - * Regular expressions pattern - */ - static private Pattern pattern = Pattern.compile( + private static final Pattern pattern = Pattern.compile( "GPRMC," + "(\\d{2})(\\d{2})(\\d{2}).(\\d{2})," + // Time (HHMMSS.SS) "([AV])," + // Validity @@ -59,9 +51,7 @@ public class EnforaProtocolDecoder extends BaseProtocolDecoder { public static final int IMEI_LENGTH = 15; - /** - * Decode message - */ + @Override protected Object decode( ChannelHandlerContext ctx, Channel channel, Object msg) throws Exception { @@ -104,6 +94,7 @@ public class EnforaProtocolDecoder extends BaseProtocolDecoder { // Create new position Position position = new Position(); + ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("enfora"); Integer index = 1; // Get device by IMEI @@ -123,7 +114,7 @@ public class EnforaProtocolDecoder extends BaseProtocolDecoder { time.set(Calendar.MILLISECOND, Integer.valueOf(parser.group(index++)) * 10); // Validity - position.setValid(parser.group(index++).compareTo("A") == 0 ? true : false); + position.setValid(parser.group(index++).compareTo("A") == 0); // Latitude Double latitude = Double.valueOf(parser.group(index++)); @@ -157,6 +148,7 @@ public class EnforaProtocolDecoder extends BaseProtocolDecoder { time.set(Calendar.YEAR, 2000 + Integer.valueOf(parser.group(index++))); position.setTime(time.getTime()); + position.setExtendedInfo(extendedInfo.toString()); return position; } diff --git a/src/org/traccar/protocol/Ev603ProtocolDecoder.java b/src/org/traccar/protocol/Ev603ProtocolDecoder.java index 322d7dd61..5be569d77 100644 --- a/src/org/traccar/protocol/Ev603ProtocolDecoder.java +++ b/src/org/traccar/protocol/Ev603ProtocolDecoder.java @@ -1,6 +1,6 @@ /*
- * Copyright 2012 Anton Tananaev (anton.tananaev@gmail.com)
- * Luis Parada (luis.parada@gmail.com)
+ * Copyright 2012 - 2013 Anton Tananaev (anton.tananaev@gmail.com)
+ * Luis Parada (luis.parada@gmail.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -36,7 +36,7 @@ public class Ev603ProtocolDecoder extends BaseProtocolDecoder{ super(serverManager);
}
- static private Pattern pattern = Pattern.compile(
+ private static final Pattern pattern = Pattern.compile(
"!A," + // Type
"(\\d{2})\\/(\\d{2})\\/(\\d{2})," + // Date dd/mm/YY
"(\\d{2}):(\\d{2}):(\\d{2})," + // Time hh:mm:ss
@@ -67,7 +67,7 @@ public class Ev603ProtocolDecoder extends BaseProtocolDecoder{ else if (sentence.startsWith("!A,")) {
// Parse message
Matcher parser = pattern.matcher(sentence);
- if (!parser.matches()) {
+ if (deviceId == null || !parser.matches()) {
return null;
}
@@ -105,10 +105,11 @@ public class Ev603ProtocolDecoder extends BaseProtocolDecoder{ // Course
position.setCourse(Double.valueOf(parser.group(index++)));
+ if (position.getCourse() > 360) {
+ position.setCourse(0.0);
+ }
- // Extended info
position.setExtendedInfo(extendedInfo.toString());
-
return position;
}
diff --git a/src/org/traccar/protocol/Gl100ProtocolDecoder.java b/src/org/traccar/protocol/Gl100ProtocolDecoder.java index d99953f24..88f9047bb 100644 --- a/src/org/traccar/protocol/Gl100ProtocolDecoder.java +++ b/src/org/traccar/protocol/Gl100ProtocolDecoder.java @@ -24,6 +24,7 @@ import org.jboss.netty.channel.ChannelHandlerContext; import org.traccar.BaseProtocolDecoder; import org.traccar.ServerManager; import org.traccar.helper.Log; +import org.traccar.model.ExtendedInfoFormatter; import org.traccar.model.Position; /** @@ -41,7 +42,7 @@ public class Gl100ProtocolDecoder extends BaseProtocolDecoder { /** * Regular expressions pattern */ - static private Pattern pattern = Pattern.compile( + private static final Pattern pattern = Pattern.compile( "\\+RESP:GT...," + "(\\d{15})," + // IMEI "(?:(?:\\d+," + // Number @@ -62,6 +63,7 @@ public class Gl100ProtocolDecoder extends BaseProtocolDecoder { /** * Decode message */ + @Override protected Object decode( ChannelHandlerContext ctx, Channel channel, Object msg) throws Exception { @@ -84,6 +86,7 @@ public class Gl100ProtocolDecoder extends BaseProtocolDecoder { // Create new position Position position = new Position(); + ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("gl100"); Integer index = 1; @@ -97,7 +100,7 @@ public class Gl100ProtocolDecoder extends BaseProtocolDecoder { } // Validity - position.setValid(Integer.valueOf(parser.group(index++)) == 0 ? false : true); + position.setValid(Integer.valueOf(parser.group(index++)) == 0); // Position info position.setSpeed(Double.valueOf(parser.group(index++))); @@ -119,6 +122,7 @@ public class Gl100ProtocolDecoder extends BaseProtocolDecoder { time.set(Calendar.SECOND, Integer.valueOf(parser.group(index++))); position.setTime(time.getTime()); + position.setExtendedInfo(extendedInfo.toString()); return position; } diff --git a/src/org/traccar/protocol/Gl200ProtocolDecoder.java b/src/org/traccar/protocol/Gl200ProtocolDecoder.java index ce845a6ec..8f3579d38 100644 --- a/src/org/traccar/protocol/Gl200ProtocolDecoder.java +++ b/src/org/traccar/protocol/Gl200ProtocolDecoder.java @@ -24,6 +24,7 @@ import org.jboss.netty.channel.ChannelHandlerContext; import org.traccar.BaseProtocolDecoder; import org.traccar.ServerManager; import org.traccar.helper.Log; +import org.traccar.model.ExtendedInfoFormatter; import org.traccar.model.Position; public class Gl200ProtocolDecoder extends BaseProtocolDecoder { @@ -61,6 +62,7 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder { // Create new position Position position = new Position(); + ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("gl200"); Integer index = 1; @@ -96,6 +98,7 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder { time.set(Calendar.SECOND, Integer.valueOf(parser.group(index++))); position.setTime(time.getTime()); + position.setExtendedInfo(extendedInfo.toString()); return position; } diff --git a/src/org/traccar/protocol/GpsGateProtocolDecoder.java b/src/org/traccar/protocol/GpsGateProtocolDecoder.java index 99954850b..075ae8654 100644 --- a/src/org/traccar/protocol/GpsGateProtocolDecoder.java +++ b/src/org/traccar/protocol/GpsGateProtocolDecoder.java @@ -25,6 +25,7 @@ import org.traccar.BaseProtocolDecoder; import org.traccar.ServerManager; import org.traccar.helper.Crc; import org.traccar.helper.Log; +import org.traccar.model.ExtendedInfoFormatter; import org.traccar.model.Position; public class GpsGateProtocolDecoder extends BaseProtocolDecoder { @@ -38,7 +39,7 @@ public class GpsGateProtocolDecoder extends BaseProtocolDecoder { /** * Regular expressions pattern */ - static private Pattern pattern = Pattern.compile( + private static final Pattern pattern = Pattern.compile( "\\$GPRMC," + "(\\d{2})(\\d{2})(\\d{2})\\.(\\d+)," + // Time (HHMMSS.SSS) "([AV])," + // Validity @@ -103,6 +104,7 @@ public class GpsGateProtocolDecoder extends BaseProtocolDecoder { // Create new position Position position = new Position(); + ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("gpsgate"); position.setDeviceId(deviceId); Integer index = 1; @@ -116,7 +118,7 @@ public class GpsGateProtocolDecoder extends BaseProtocolDecoder { index += 1; // Skip milliseconds // Validity - position.setValid(parser.group(index++).compareTo("A") == 0 ? true : false); + position.setValid(parser.group(index++).compareTo("A") == 0); // Latitude Double latitude = Double.valueOf(parser.group(index++)); @@ -155,6 +157,7 @@ public class GpsGateProtocolDecoder extends BaseProtocolDecoder { // Altitude position.setAltitude(0.0); + position.setExtendedInfo(extendedInfo.toString()); return position; } diff --git a/src/org/traccar/protocol/Jt600ProtocolDecoder.java b/src/org/traccar/protocol/Jt600ProtocolDecoder.java index d12b09740..847e3859a 100644 --- a/src/org/traccar/protocol/Jt600ProtocolDecoder.java +++ b/src/org/traccar/protocol/Jt600ProtocolDecoder.java @@ -127,7 +127,7 @@ public class Jt600ProtocolDecoder extends BaseProtocolDecoder { return position; } - static private Pattern pattern = Pattern.compile( + private static final Pattern pattern = Pattern.compile( "\\(" + "([\\d]+)," + // Id "W01," + // Type @@ -184,7 +184,7 @@ public class Jt600ProtocolDecoder extends BaseProtocolDecoder { position.setLatitude(latitude); // Validity - position.setValid(parser.group(index++).compareTo("A") == 0 ? true : false); + position.setValid(parser.group(index++).compareTo("A") == 0); // Time Calendar time = Calendar.getInstance(TimeZone.getTimeZone("UTC")); @@ -202,6 +202,9 @@ public class Jt600ProtocolDecoder extends BaseProtocolDecoder { // Course position.setCourse(Double.valueOf(parser.group(index++))); + + // Altitude + position.setAltitude(0.0); // Power extendedInfo.set("power", Double.valueOf(parser.group(index++))); diff --git a/src/org/traccar/protocol/MegastekProtocolDecoder.java b/src/org/traccar/protocol/MegastekProtocolDecoder.java index dc55dbed1..8032a0b9d 100644 --- a/src/org/traccar/protocol/MegastekProtocolDecoder.java +++ b/src/org/traccar/protocol/MegastekProtocolDecoder.java @@ -239,6 +239,9 @@ public class MegastekProtocolDecoder extends BaseProtocolDecoder { } int index = 1; + + // Altitude + position.setAltitude(0.0); try { position.setDeviceId(getDataManager().getDeviceByImei(id).getId()); diff --git a/src/org/traccar/protocol/MeitrackProtocolDecoder.java b/src/org/traccar/protocol/MeitrackProtocolDecoder.java index af269f58b..3cf822000 100644 --- a/src/org/traccar/protocol/MeitrackProtocolDecoder.java +++ b/src/org/traccar/protocol/MeitrackProtocolDecoder.java @@ -33,7 +33,7 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder { super(serverManager); } - static private Pattern pattern = Pattern.compile( + private static final Pattern pattern = Pattern.compile( "\\$\\$." + // Flag "\\d+," + // Length "(\\d+)," + // IMEI @@ -48,7 +48,7 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder { "(\\d+)," + // GSM Signal "(\\d+)," + // Speed "(\\d+)," + // Course - "(\\d+.?\\d*)," + // HDOP + "(\\d+\\.?\\d*)," + // HDOP "(\\d+)," + // Altitude "(\\d+)," + // Milage ".*"); // TODO: parse other stuff @@ -99,7 +99,7 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder { position.setTime(time.getTime()); // Validity - position.setValid(parser.group(index++).compareTo("A") == 0 ? true : false); + position.setValid(parser.group(index++).compareTo("A") == 0); // Satellites extendedInfo.set("satellites", parser.group(index++)); diff --git a/src/org/traccar/protocol/SkypatrolProtocolDecoder.java b/src/org/traccar/protocol/SkypatrolProtocolDecoder.java index 72fa45ac7..bf1295aea 100644 --- a/src/org/traccar/protocol/SkypatrolProtocolDecoder.java +++ b/src/org/traccar/protocol/SkypatrolProtocolDecoder.java @@ -1,5 +1,5 @@ /* - * Copyright 2012 Anton Tananaev (anton.tananaev@gmail.com) + * Copyright 2012 - 2013 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. @@ -27,14 +27,8 @@ import org.traccar.helper.Log; import org.traccar.model.ExtendedInfoFormatter; import org.traccar.model.Position; -/** - * T55 tracker protocol decoder - */ public class SkypatrolProtocolDecoder extends BaseProtocolDecoder { - /** - * Initialize - */ public SkypatrolProtocolDecoder(ServerManager serverManager) { super(serverManager); } @@ -57,9 +51,6 @@ public class SkypatrolProtocolDecoder extends BaseProtocolDecoder { return sign * degrees; } - /** - * Decode message - */ @Override protected Object decode( ChannelHandlerContext ctx, Channel channel, Object msg) @@ -177,7 +168,7 @@ public class SkypatrolProtocolDecoder extends BaseProtocolDecoder { // Altitude if (checkBit(mask, 15)) { - buf.skipBytes(3); + position.setAltitude((double) buf.readMedium()); } // Satellites diff --git a/src/org/traccar/protocol/T55ProtocolDecoder.java b/src/org/traccar/protocol/T55ProtocolDecoder.java index 05a6ad4ae..246036313 100644 --- a/src/org/traccar/protocol/T55ProtocolDecoder.java +++ b/src/org/traccar/protocol/T55ProtocolDecoder.java @@ -35,7 +35,7 @@ public class T55ProtocolDecoder extends BaseProtocolDecoder { super(serverManager); } - static private Pattern patternGPRMC = Pattern.compile( + private static final Pattern patternGPRMC = Pattern.compile( "\\$GPRMC," + "(\\d{2})(\\d{2})(\\d{2})\\.?\\d*," + // Time (HHMMSS.SSS) "([AV])," + // Validity @@ -48,7 +48,7 @@ public class T55ProtocolDecoder extends BaseProtocolDecoder { "(\\d{2})(\\d{2})(\\d{2})" + // Date (DDMMYY) ".+"); - static private Pattern patternGPGGA = Pattern.compile( + private static final Pattern patternGPGGA = Pattern.compile( "\\$GPGGA," + "(\\d{2})(\\d{2})(\\d{2})\\.?\\d*," + // Time "(\\d{2})(\\d{2}\\.\\d+)," + // Latitude @@ -57,7 +57,7 @@ public class T55ProtocolDecoder extends BaseProtocolDecoder { "([EW])," + ".+"); - static private Pattern patternGPRMA = Pattern.compile( + private static final Pattern patternGPRMA = Pattern.compile( "\\$GPRMA," + "([AV])," + // Validity "(\\d{2})(\\d{2}\\.\\d+)," + // Latitude @@ -124,7 +124,7 @@ public class T55ProtocolDecoder extends BaseProtocolDecoder { time.set(Calendar.SECOND, Integer.valueOf(parser.group(index++))); // Validity - position.setValid(parser.group(index++).compareTo("A") == 0 ? true : false); + position.setValid(parser.group(index++).compareTo("A") == 0); // Latitude Double latitude = Double.valueOf(parser.group(index++)); @@ -205,6 +205,12 @@ public class T55ProtocolDecoder extends BaseProtocolDecoder { longitude += Double.valueOf(parser.group(index++)) / 60; if (parser.group(index++).compareTo("W") == 0) longitude = -longitude; position.setLongitude(longitude); + + // Speed + position.setSpeed(0.0); + + // Course + position.setCourse(0.0); // Altitude position.setAltitude(0.0); diff --git a/src/org/traccar/protocol/TotemProtocolDecoder.java b/src/org/traccar/protocol/TotemProtocolDecoder.java index 1a0f22d80..bf88523f9 100644 --- a/src/org/traccar/protocol/TotemProtocolDecoder.java +++ b/src/org/traccar/protocol/TotemProtocolDecoder.java @@ -288,7 +288,7 @@ public class TotemProtocolDecoder extends BaseProtocolDecoder { extendedInfo.set("lac", parser.group(index++)); // Validity - position.setValid(parser.group(index++).compareTo("A") == 0 ? true : false); + position.setValid(parser.group(index++).compareTo("A") == 0); // Satellites extendedInfo.set("satellites", parser.group(index++)); @@ -299,6 +299,9 @@ public class TotemProtocolDecoder extends BaseProtocolDecoder { // Speed position.setSpeed(Double.valueOf(parser.group(index++))); + // Altitude + position.setAltitude(0.0); + // PDOP extendedInfo.set("pdop", parser.group(index++)); diff --git a/src/org/traccar/protocol/V680ProtocolDecoder.java b/src/org/traccar/protocol/V680ProtocolDecoder.java index 0f5d4b942..7541bb618 100644 --- a/src/org/traccar/protocol/V680ProtocolDecoder.java +++ b/src/org/traccar/protocol/V680ProtocolDecoder.java @@ -35,6 +35,7 @@ public class V680ProtocolDecoder extends BaseProtocolDecoder { super(serverManager); } + //#359094025419110#bigfriend#0#1234#AUTO#1##04632.8846,W,2327.2264,S,0.00,0.00#220913#234808## private static final Pattern pattern = Pattern.compile( "(?:#(\\d+)#" + // IMEI "([^#]*)#)?" + // User @@ -42,7 +43,7 @@ public class V680ProtocolDecoder extends BaseProtocolDecoder { "([^#]+)#" + // Password "[^#]+#" + "(\\d+)#" + // Packet number - "([^#]+)#" + // GSM base station + "([^#]+)?#?" + // GSM base station "(?:[^#]+#)?" + "(\\d+)(\\d{2}\\.\\d+)," + // Longitude (DDDMM.MMMM) "([EW])," + @@ -139,8 +140,13 @@ public class V680ProtocolDecoder extends BaseProtocolDecoder { // Date Calendar time = Calendar.getInstance(TimeZone.getTimeZone("UTC")); time.clear(); - time.set(Calendar.DAY_OF_MONTH, Integer.valueOf(parser.group(index++))); - time.set(Calendar.MONTH, Integer.valueOf(parser.group(index++)) - 1); + int day = Integer.valueOf(parser.group(index++)); + int month = Integer.valueOf(parser.group(index++)); + if (day == 0 && month == 0) { + return null; // invalid date + } + time.set(Calendar.DAY_OF_MONTH, day); + time.set(Calendar.MONTH, month - 1); time.set(Calendar.YEAR, 2000 + Integer.valueOf(parser.group(index++))); // Time @@ -149,9 +155,7 @@ public class V680ProtocolDecoder extends BaseProtocolDecoder { time.set(Calendar.SECOND, Integer.valueOf(parser.group(index++))); position.setTime(time.getTime()); - // Extended info position.setExtendedInfo(extendedInfo.toString()); - return position; } diff --git a/src/org/traccar/protocol/XexunProtocolDecoder.java b/src/org/traccar/protocol/XexunProtocolDecoder.java index 03d746c34..bc92e4fb6 100644 --- a/src/org/traccar/protocol/XexunProtocolDecoder.java +++ b/src/org/traccar/protocol/XexunProtocolDecoder.java @@ -25,6 +25,7 @@ import org.jboss.netty.channel.ChannelHandlerContext; import org.traccar.BaseProtocolDecoder; import org.traccar.ServerManager; import org.traccar.helper.Log; +import org.traccar.model.ExtendedInfoFormatter; import org.traccar.model.Position; public class XexunProtocolDecoder extends BaseProtocolDecoder { @@ -61,6 +62,7 @@ public class XexunProtocolDecoder extends BaseProtocolDecoder { // Create new position Position position = new Position(); + ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("xexun"); Integer index = 1; @@ -73,7 +75,7 @@ public class XexunProtocolDecoder extends BaseProtocolDecoder { time.set(Calendar.MILLISECOND, Integer.valueOf(parser.group(index++))); // Validity - position.setValid(parser.group(index++).compareTo("A") == 0 ? true : false); + position.setValid(parser.group(index++).compareTo("A") == 0); // Latitude Double latitude = Double.valueOf(parser.group(index++)); @@ -116,6 +118,7 @@ public class XexunProtocolDecoder extends BaseProtocolDecoder { return null; } + position.setExtendedInfo(extendedInfo.toString()); return position; } diff --git a/src/org/traccar/protocol/Xt7ProtocolDecoder.java b/src/org/traccar/protocol/Xt7ProtocolDecoder.java index cee9d18a7..42013cb9a 100644 --- a/src/org/traccar/protocol/Xt7ProtocolDecoder.java +++ b/src/org/traccar/protocol/Xt7ProtocolDecoder.java @@ -35,7 +35,7 @@ public class Xt7ProtocolDecoder extends BaseProtocolDecoder { super(serverManager); } - static private Pattern pattern = Pattern.compile( + private static final Pattern pattern = Pattern.compile( "\\$GPRMC," + "(\\d{2})(\\d{2})(\\d{2})\\.(\\d+)," + // Time (HHMMSS.SSS) "([AV])," + // Validity @@ -99,7 +99,7 @@ public class Xt7ProtocolDecoder extends BaseProtocolDecoder { time.set(Calendar.MILLISECOND, Integer.valueOf(parser.group(index++))); // Validity - position.setValid(parser.group(index++).compareTo("A") == 0 ? true : false); + position.setValid(parser.group(index++).compareTo("A") == 0); // Latitude Double latitude = Double.valueOf(parser.group(index++)); @@ -123,6 +123,9 @@ public class Xt7ProtocolDecoder extends BaseProtocolDecoder { } else { position.setCourse(0.0); } + + // Altitude + position.setAltitude(0.0); // Date time.set(Calendar.DAY_OF_MONTH, Integer.valueOf(parser.group(index++))); diff --git a/test/org/traccar/helper/DecoderVerifier.java b/test/org/traccar/helper/DecoderVerifier.java new file mode 100644 index 000000000..d73d9d58f --- /dev/null +++ b/test/org/traccar/helper/DecoderVerifier.java @@ -0,0 +1,62 @@ +package org.traccar.helper; + +import java.util.Date; +import java.util.List; +import static org.junit.Assert.*; +import org.traccar.model.Position; + +public class DecoderVerifier { + + private static void verifyPosition(Position position) { + + assertNotNull(position.getDeviceId()); + + assertNotNull(position.getTime()); + assertTrue(position.getTime().after(new Date(946684800000L))); // 2000 year + assertTrue(position.getTime().getTime() < new Date().getTime() + 3600000); // 1 hour from now + + assertNotNull(position.getValid()); + + assertNotNull(position.getLatitude()); + assertTrue(position.getLatitude() >= -90); + assertTrue(position.getLatitude() <= 90); + + assertNotNull(position.getLongitude()); + assertTrue(position.getLongitude() >= -180); + assertTrue(position.getLongitude() <= 180); + + assertNotNull(position.getAltitude()); + assertTrue(position.getAltitude() >= -12262); + assertTrue(position.getAltitude() <= 18000); + + assertNotNull(position.getSpeed()); + assertTrue(position.getSpeed() >= 0); + assertTrue(position.getSpeed() <= 869); + + assertNotNull(position.getCourse()); + assertTrue(position.getCourse() >= 0); + assertTrue(position.getCourse() <= 360); + + assertNotNull(position.getExtendedInfo()); + + } + + public static void verify(Object object) { + + assertNotNull(object); + + if (object instanceof Position) { + verifyPosition((Position) object); + } else if (object instanceof List) { + List<Position> positions = (List<Position>) object; + + assertFalse(positions.isEmpty()); + + for (Position position : positions) { + verifyPosition(position); + } + } + + } + +} diff --git a/test/org/traccar/protocol/TestDataManager.java b/test/org/traccar/helper/TestDataManager.java index 7466f5ace..8503791e7 100644 --- a/test/org/traccar/protocol/TestDataManager.java +++ b/test/org/traccar/helper/TestDataManager.java @@ -1,4 +1,4 @@ -package org.traccar.protocol; +package org.traccar.helper; import java.util.List; import org.traccar.model.DataManager; diff --git a/test/org/traccar/protocol/ApelProtocolDecoderTest.java b/test/org/traccar/protocol/ApelProtocolDecoderTest.java index f5c226acb..b094552c9 100644 --- a/test/org/traccar/protocol/ApelProtocolDecoderTest.java +++ b/test/org/traccar/protocol/ApelProtocolDecoderTest.java @@ -1,8 +1,9 @@ package org.traccar.protocol; +import org.traccar.helper.TestDataManager; import java.nio.ByteOrder; import org.jboss.netty.buffer.ChannelBuffers; -import static org.junit.Assert.assertNotNull; +import static org.traccar.helper.DecoderVerifier.verify; import static org.junit.Assert.assertNull; import org.junit.Test; diff --git a/test/org/traccar/protocol/AplicomProtocolDecoderTest.java b/test/org/traccar/protocol/AplicomProtocolDecoderTest.java index a9f53c4c4..17a513f3f 100644 --- a/test/org/traccar/protocol/AplicomProtocolDecoderTest.java +++ b/test/org/traccar/protocol/AplicomProtocolDecoderTest.java @@ -1,7 +1,8 @@ package org.traccar.protocol;
+import org.traccar.helper.TestDataManager;
import org.jboss.netty.buffer.ChannelBuffers;
-import static org.junit.Assert.assertNotNull;
+import static org.traccar.helper.DecoderVerifier.verify;
import org.junit.Test;
import org.traccar.helper.ChannelBufferTools;
@@ -14,10 +15,10 @@ public class AplicomProtocolDecoderTest { decoder.setDataManager(new TestDataManager());
int[] buf1 = {0x44,0xC2,0x01,0x43,0x72,0x07,0x29,0xD6,0x84,0x00,0x43,0x03,0x1f,0xff,0x71,0x91,0xC0,0x45,0x0e,0xf9,0x06,0x45,0x0e,0xf9,0x06,0x03,0xb2,0x0b,0x80,0x03,0xb2,0x0b,0x80,0x06,0x64,0x65,0xb3,0x87,0x0c,0xe3,0x0f,0x01,0x0c,0xe3,0x0c,0xe3,0x00,0x32,0x00,0x00,0x15,0x20,0x00,0x00,0x00,0x03,0x0a,0xa2,0x00,0x00,0x3b,0x13,0x00,0x00,0x00,0x32,0x03,0x00,0x00,0x0b,0xcb,0x17,0xac,0xff,0x00,0x99,0x00,0x01,0x86,0xa0,0x02};
- assertNotNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray(buf1))));
+ verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray(buf1))));
int[] buf2 = {0x44,0x01,0x29,0xD6,0x84,0x00,0x2b,0x07,0x00,0xC0,0x45,0x0e,0xf9,0x06,0x45,0x0e,0xf9,0x06,0x03,0xb2,0x0b,0x80,0x03,0xb2,0x0b,0x80,0x06,0x64,0x65,0xb3,0x87,0x0c,0xe3,0x0f,0x01,0x0c,0xe3,0x0c,0xe3,0x00,0x00,0x3b,0x13,0x03,0x00,0x00,0x0b,0xcb,0x17,0xa};
- assertNotNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray(buf2))));
+ verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray(buf2))));
}
diff --git a/test/org/traccar/protocol/AtrackProtocolDecoderTest.java b/test/org/traccar/protocol/AtrackProtocolDecoderTest.java index 69bf03059..4856de6dc 100644 --- a/test/org/traccar/protocol/AtrackProtocolDecoderTest.java +++ b/test/org/traccar/protocol/AtrackProtocolDecoderTest.java @@ -1,7 +1,8 @@ package org.traccar.protocol; +import org.traccar.helper.TestDataManager; import org.jboss.netty.buffer.ChannelBuffers; -import static org.junit.Assert.assertNotNull; +import static org.traccar.helper.DecoderVerifier.verify; import static org.junit.Assert.assertNull; import org.junit.Test; import org.traccar.helper.ChannelBufferTools; @@ -18,10 +19,10 @@ public class AtrackProtocolDecoderTest { //assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray(buf1)))); int[] buf2 = {0x40,0x50,0x99,0x3f,0x00,0x5c,0x00,0x02,0x00,0x01,0x41,0x04,0xd8,0xf1,0x96,0x82,0x52,0x56,0x66,0xc2,0x52,0x56,0x8c,0x3c,0x52,0x56,0x8c,0x63,0xff,0xc8,0x33,0x84,0x02,0x69,0x88,0x85,0x00,0x00,0x02,0x00,0x00,0x09,0xcf,0x03,0xde,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xd0,0x07,0xd0,0x00,0x52,0x56,0x66,0xc2,0x52,0x56,0x8c,0x5a,0x52,0x56,0x8c,0x63,0xff,0xc8,0x33,0x84,0x02,0x69,0x88,0x85,0x00,0x00,0x02,0x00,0x00,0x09,0xcf,0x03,0xde,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xd0,0x07,0xd0,0x00}; - assertNotNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray(buf2)))); + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray(buf2)))); int[] buf3 = {0x40,0x50,0x1e,0x58,0x00,0x33,0x01,0xe0,0x00,0x01,0x41,0x04,0xd8,0xf1,0x96,0x82,0x52,0x5e,0xcd,0x5d,0x52,0x5e,0xe3,0x44,0x52,0x5e,0xe3,0x5e,0xff,0xc8,0x88,0x15,0x02,0x6a,0xb4,0xd7,0x00,0x00,0x02,0x00,0x00,0x10,0x44,0x03,0xde,0x01,0x00,0x0b,0x00,0x00,0x00,0x00,0x07,0xd0,0x07,0xd0,0x00}; - assertNotNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray(buf3)))); + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray(buf3)))); } diff --git a/test/org/traccar/protocol/CarscopProtocolDecoderTest.java b/test/org/traccar/protocol/CarscopProtocolDecoderTest.java index 63e27f738..5978ab7b1 100644 --- a/test/org/traccar/protocol/CarscopProtocolDecoderTest.java +++ b/test/org/traccar/protocol/CarscopProtocolDecoderTest.java @@ -1,6 +1,7 @@ package org.traccar.protocol; -import static org.junit.Assert.assertNotNull; +import org.traccar.helper.TestDataManager; +import static org.traccar.helper.DecoderVerifier.verify; import static org.junit.Assert.assertNull; import org.junit.Test; @@ -12,13 +13,13 @@ public class CarscopProtocolDecoderTest { CarscopProtocolDecoder decoder = new CarscopProtocolDecoder(null); decoder.setDataManager(new TestDataManager()); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "*040331141830UB05123456789012345061825A2934.0133N10627.2544E000.0040331309.6200000000L000000")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "*040331141830UB04999999984061825A2934.0133N10627.2544E000.0040331309.6200000000L000000")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "*040331141830UA012Hi-jack061825A2934.0133N10627.2544E000.0040331309.6200000000L000000")); } diff --git a/test/org/traccar/protocol/CellocatorProtocolDecoderTest.java b/test/org/traccar/protocol/CellocatorProtocolDecoderTest.java index 5d5594fcb..2788e6ba1 100644 --- a/test/org/traccar/protocol/CellocatorProtocolDecoderTest.java +++ b/test/org/traccar/protocol/CellocatorProtocolDecoderTest.java @@ -1,8 +1,9 @@ package org.traccar.protocol; +import org.traccar.helper.TestDataManager; import java.nio.ByteOrder; import org.jboss.netty.buffer.ChannelBuffers; -import static org.junit.Assert.assertNotNull; +import static org.traccar.helper.DecoderVerifier.verify; import org.junit.Test; import org.traccar.helper.ChannelBufferTools; @@ -15,13 +16,13 @@ public class CellocatorProtocolDecoderTest { decoder.setDataManager(new TestDataManager()); int[] buf1 = {0x4D,0x43,0x47,0x50,0x00,0x06,0x00,0x00,0x00,0x08,0x1A,0x02,0x02,0x12,0x04,0x00,0x00,0x00,0x21,0x00,0x62,0x30,0x00,0x00,0x00,0x6B,0x00,0xE1,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE5,0xA1,0x00,0x04,0x02,0x06,0x61,0x4E,0xA3,0x03,0x18,0x1A,0x57,0x03,0x4E,0x12,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x15,0x25,0x07,0x14,0x03,0xD6,0x07,0x49}; - assertNotNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertArray(buf1)))); + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertArray(buf1)))); int[] buf2 = {0x4d,0x43,0x47,0x50,0x00,0x01,0x01,0x00,0x00,0x08,0x01,0x1f,0x04,0x18,0x04,0x00,0x00,0x00,0x20,0x01,0x00,0x00,0x00,0x00,0x00,0x5e,0x75,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x54,0x85,0x00,0x04,0x02,0x04,0xda,0x4d,0xa3,0x03,0x67,0x19,0x57,0x03,0xe8,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x14,0x15,0x10,0x07,0xdd,0x07,0xf7}; - assertNotNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertArray(buf2)))); + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertArray(buf2)))); int[] buf3 = {0x4d,0x43,0x47,0x50,0x00,0x5e,0x93,0x01,0x00,0x08,0x01,0x02,0x04,0x18,0x04,0x00,0x00,0x00,0x20,0x0f,0x20,0x00,0x00,0x00,0x00,0x5e,0x75,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x5a,0xf4,0x00,0x04,0x02,0x04,0xda,0x4d,0xa3,0x03,0x67,0x19,0x57,0x03,0xe8,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x1a,0x11,0x1e,0x08,0xdd,0x07,0x60}; - assertNotNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertArray(buf3)))); + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertArray(buf3)))); } diff --git a/test/org/traccar/protocol/EasyTrackProtocolDecoderTest.java b/test/org/traccar/protocol/EasyTrackProtocolDecoderTest.java index 2c20d4f1b..0160d4367 100644 --- a/test/org/traccar/protocol/EasyTrackProtocolDecoderTest.java +++ b/test/org/traccar/protocol/EasyTrackProtocolDecoderTest.java @@ -1,6 +1,7 @@ package org.traccar.protocol; -import static org.junit.Assert.assertNotNull; +import org.traccar.helper.TestDataManager; +import static org.traccar.helper.DecoderVerifier.verify; import static org.junit.Assert.assertNull; import org.junit.Test; @@ -14,19 +15,19 @@ public class EasyTrackProtocolDecoderTest { assertNull(decoder.decode(null, null, "*ET,135790246811221,GZ,0001,0005")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "*ET,135790246811221,DW,A,0A090D,101C0D,00CF27C6,0413FA4E,0000,0000,00000000,20,4,0000,00F123")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "*ET,135790246811221,DW,A,0A090D,101C0D,00CF27C6,0413FA4E,0000,0000,00000000,20,4,0000,00F123,100")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "*ET,135790246811221,DW,A,0A090D,101C0D,00CF27C6,8413FA4E,0000,0000,00000000,20,4,0000,00F123,100")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "*ET,358155100003016,HB,A,0d081e,07381e,8038ee09,03d2e9be,004f,0000,40c00000,0f,100,0000,00037c,29")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "*ET,358155100003016,HB,A,0d081e,073900,8038ee2f,03d2e9fd,0114,0000,40c00000,12,100,0000,00037c,32")); } diff --git a/test/org/traccar/protocol/EnforaProtocolDecoderTest.java b/test/org/traccar/protocol/EnforaProtocolDecoderTest.java index a0a2e1b6f..4e79c1cf0 100644 --- a/test/org/traccar/protocol/EnforaProtocolDecoderTest.java +++ b/test/org/traccar/protocol/EnforaProtocolDecoderTest.java @@ -1,8 +1,9 @@ package org.traccar.protocol; +import org.traccar.helper.TestDataManager; import org.jboss.netty.buffer.ChannelBufferFactory; import org.jboss.netty.buffer.HeapChannelBufferFactory; -import static org.junit.Assert.assertNotNull; +import static org.traccar.helper.DecoderVerifier.verify; import static org.junit.Assert.assertNull; import org.junit.Test; @@ -22,10 +23,10 @@ public class EnforaProtocolDecoderTest { assertNull(decoder.decode(null, null, factory.getBuffer(buf2, 0, buf2.length))); byte[] buf3 = {0x00,0x71,0x00,0x04,0x02,0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x38,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x30,0x31,0x32,0x33,0x34,0x35,0x20,0x31,0x33,0x20,0x24,0x47,0x50,0x52,0x4D,0x43,0x2C,0x32,0x32,0x33,0x31,0x35,0x32,0x2E,0x30,0x30,0x2C,0x41,0x2C,0x33,0x35,0x30,0x39,0x2E,0x38,0x36,0x30,0x35,0x39,0x34,0x2C,0x4E,0x2C,0x30,0x33,0x33,0x32,0x32,0x2E,0x37,0x34,0x33,0x38,0x38,0x37,0x2C,0x45,0x2C,0x30,0x2E,0x30,0x2C,0x30,0x2E,0x30,0x2C,0x30,0x32,0x30,0x36,0x31,0x32,0x2C,0x2C,0x2C,0x41,0x2A,0x35,0x32,0x0D,0x0A}; - assertNotNull(decoder.decode(null, null, factory.getBuffer(buf3, 0, buf3.length))); + verify(decoder.decode(null, null, factory.getBuffer(buf3, 0, buf3.length))); byte[] buf4 = {0x00,0x76,0x00,0x04,0x02,0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x38,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x30,0x31,0x31,0x38,0x39,0x32,0x30,0x30,0x30,0x36,0x30,0x38,0x31,0x38,0x39,0x20,0x31,0x33,0x20,0x24,0x47,0x50,0x52,0x4D,0x43,0x2C,0x31,0x37,0x31,0x38,0x34,0x31,0x2E,0x30,0x30,0x2C,0x41,0x2C,0x33,0x35,0x30,0x39,0x2E,0x38,0x35,0x32,0x34,0x31,0x30,0x2C,0x4E,0x2C,0x30,0x33,0x33,0x32,0x32,0x2E,0x37,0x35,0x39,0x31,0x31,0x33,0x2C,0x45,0x2C,0x30,0x2E,0x30,0x2C,0x30,0x2E,0x30,0x2C,0x31,0x37,0x30,0x37,0x31,0x32,0x2C,0x33,0x2E,0x34,0x2C,0x57,0x2C,0x41,0x2A,0x32,0x35,0x0D,0x0A,0x00}; - assertNotNull(decoder.decode(null, null, factory.getBuffer(buf4, 0, buf4.length))); + verify(decoder.decode(null, null, factory.getBuffer(buf4, 0, buf4.length))); } } diff --git a/test/org/traccar/protocol/Ev603ProtocolDecoderTest.java b/test/org/traccar/protocol/Ev603ProtocolDecoderTest.java index c4ecc5c7b..230ad238a 100644 --- a/test/org/traccar/protocol/Ev603ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/Ev603ProtocolDecoderTest.java @@ -1,6 +1,7 @@ package org.traccar.protocol; -import static org.junit.Assert.assertNotNull; +import org.traccar.helper.TestDataManager; +import static org.traccar.helper.DecoderVerifier.verify; import static org.junit.Assert.assertNull; import org.junit.Test; @@ -12,12 +13,14 @@ public class Ev603ProtocolDecoderTest { Ev603ProtocolDecoder decoder = new Ev603ProtocolDecoder(null); decoder.setDataManager(new TestDataManager()); + assertNull(decoder.decode(null, null, "!1,123456789012345")); + assertNull(decoder.decode(null, null, "!5,17,V")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "!A,26/10/12,00:28:41,7.770385,-72.215706,0.0,25101,0")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "!A,01/12/10,13:25:35,22.641724,114.023666,000.1,281.6,0")); } diff --git a/test/org/traccar/protocol/GalileoProtocolDecoderTest.java b/test/org/traccar/protocol/GalileoProtocolDecoderTest.java index 32836bce2..385b6a881 100644 --- a/test/org/traccar/protocol/GalileoProtocolDecoderTest.java +++ b/test/org/traccar/protocol/GalileoProtocolDecoderTest.java @@ -1,5 +1,6 @@ package org.traccar.protocol; +import org.traccar.helper.TestDataManager; import java.nio.ByteOrder; import org.jboss.netty.buffer.ChannelBuffers; import static org.junit.Assert.assertNull; diff --git a/test/org/traccar/protocol/GatorProtocolDecoderTest.java b/test/org/traccar/protocol/GatorProtocolDecoderTest.java index fb49013b8..251987cb0 100644 --- a/test/org/traccar/protocol/GatorProtocolDecoderTest.java +++ b/test/org/traccar/protocol/GatorProtocolDecoderTest.java @@ -1,7 +1,8 @@ package org.traccar.protocol; +import org.traccar.helper.TestDataManager; import org.jboss.netty.buffer.ChannelBuffers; -import static org.junit.Assert.assertNotNull; +import static org.traccar.helper.DecoderVerifier.verify; import org.junit.Test; import org.traccar.helper.ChannelBufferTools; @@ -14,10 +15,10 @@ public class GatorProtocolDecoderTest { decoder.setDataManager(new TestDataManager()); int[] buf1 = {0x24,0x24,0x81,0x00,0x23,0x0C,0xA2,0x32,0x85,0x10,0x03,0x06,0x14,0x59,0x07,0x02,0x23,0x46,0x90,0x11,0x35,0x29,0x47,0x00,0x00,0x00,0x00,0xC0,0x40,0x01,0x01,0x2C,0x0E,0x11,0x00,0x00,0x00,0x21,0xCB,0x0D}; - assertNotNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray(buf1)))); + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray(buf1)))); int[] buf2 = {0x24,0x24,0x80,0x00,0x23,0xc2,0x63,0x1e,0x00,0x11,0x12,0x20,0x10,0x49,0x09,0x83,0x32,0x68,0x64,0x87,0x03,0x80,0x41,0x00,0x00,0x00,0x00,0xc0,0x47,0x00,0x00,0x00,0x0b,0x4e,0x00,0x00,0x00,0x00,0x55,0x0d}; - assertNotNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray(buf2)))); + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray(buf2)))); } diff --git a/test/org/traccar/protocol/Gl100ProtocolDecoderTest.java b/test/org/traccar/protocol/Gl100ProtocolDecoderTest.java index b705e446e..6cfa34501 100644 --- a/test/org/traccar/protocol/Gl100ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/Gl100ProtocolDecoderTest.java @@ -1,6 +1,7 @@ package org.traccar.protocol; -import static org.junit.Assert.assertNotNull; +import org.traccar.helper.TestDataManager; +import static org.traccar.helper.DecoderVerifier.verify; import org.junit.Test; public class Gl100ProtocolDecoderTest { @@ -11,28 +12,28 @@ public class Gl100ProtocolDecoderTest { Gl100ProtocolDecoder decoder = new Gl100ProtocolDecoder(null); decoder.setDataManager(new TestDataManager()); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "+RESP:GTSOS,359231030000010,0,0,0,1,4.3,92,70.0,1,121.354335,31.222073,20090101000000,0460,0000,18d8,6141,00,11F0,0102120204")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "+RESP:GTRTL,359231030000010,0,0,0,1,4.3,92,70.0,1,121.354335,31.222073,20090101000000,0460,0000,18d8,6141,00,11F0,0102120204")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "+RESP:GTEST,359231030000010,0,0,0,1,4.3,92,70.0,1,121.354335,31.222073,20090101000000,0460,0000,18d8,6141,00,11F0,0102120204")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "+RESP:GTSZI,359231030000010,0,3,0,1,4.3,92,70.0,1,121.354335,31.222073,20090101000000,0460,0000,18d8,6141,00,11F0,0102120204")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "+RESP:GTLBC,359231030000010,02132523415,1,4.3,92,70.0,1,121.354335,31.222073,20090101000000,0460,0000,18d8,6141,00,11F0,0102120204")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "+RESP:GTTRI,359231030000010,1,0,0,1,4.3,92,70.0,1,121.354335,31.222073,20090101000000,0460,0000,18d8,6141,00,11F0,0102120204")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "+RESP:GTTRI,359231030000010,2,0,0,1,4.3,92,70.0,1,121.354335,31.222073,20090101000000,0460,0000,18d8,6141,00,0,0,1,-3.6,145,30.0,2,121.354442,31.221940,20090101000100,0460,0000,18d8,6141,00,11F0,0102120204")); - //assertNotNull(decoder.decode(null, null, + //verify(decoder.decode(null, null, // "AT+GTHBD=HeartBeat,359231030000010,20090101000000,11F0,0102120204")); } diff --git a/test/org/traccar/protocol/Gl200ProtocolDecoderTest.java b/test/org/traccar/protocol/Gl200ProtocolDecoderTest.java index 333c38d39..2ec7f189c 100644 --- a/test/org/traccar/protocol/Gl200ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/Gl200ProtocolDecoderTest.java @@ -1,6 +1,7 @@ package org.traccar.protocol; -import static org.junit.Assert.assertNotNull; +import org.traccar.helper.TestDataManager; +import static org.traccar.helper.DecoderVerifier.verify; import static org.junit.Assert.assertNull; import org.junit.Test; @@ -12,67 +13,67 @@ public class Gl200ProtocolDecoderTest { Gl200ProtocolDecoder decoder = new Gl200ProtocolDecoder(null); decoder.setDataManager(new TestDataManager()); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "+RESP:GTFRI,04040C,359231038939904,,,10,1,2,0.0,117,346.0,8.924243,50.798077,20130618122040,0262,0002,0299,109C,00,0.0,,,,,,,,,20130618122045,00F6")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "+RESP:GTSTT,04040C,359231038939904,,42,0,0.0,117,346.0,8.924243,50.798077,20130618125152,0262,0002,0299,109C,00,20130618125154,017A")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "+RESP:GTFRI,020102,000035988863964,,0,0,1,1,4.3,92,70.0,121.354335,31.222073,20090214013254,0460,0000,18d8,6141,00,,20090214093254,11F0")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "+RESP:GTFRI,020102,135790246811220,,0,0,1,1,4.3,92,70.0,121.354335,31.222073,20090214013254,0460,0000,18d8,6141,00,,20090214093254,11F0")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "+RESP:GTFRI,020102,135790246811220,,0,0,2,1,4.3,92,70.0,121.354335,31.222073,20090214013254,0460,0000,18d8,6141,00,0,4.3,92,70.0,121.354335,31.222073,20090101000000,0460,0000,18d8,6141,00,,20090214093254,11F0")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "+RESP:GTDOG,020102,135790246811220,,0,0,1,1,4.3,92,70.0,121.354335,31.222073,20090214013254,0460,0000,18d8,6141,00,2000.0,20090214093254,11F0")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "+RESP:GTLBC,020102,135790246811220,,+8613800000000,1,4.3,92,70.0,121.354335,31.222073,20090214013254,0460,0000,18d8,6141,00,,20090214093254,11F0")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "+RESP:GTGCR,020102,135790246811220,,3,50,180,2,0.4,296,-5.4,121.391055,31.164473,20100714104934,0460,0000,1878,0873,00,,20100714104934,000C")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "+RESP:GTFRI,07000D,868487001005941,,0,0,1,1,0.0,0,46.3,-77.039627,38.907573,20120731175232,0310,0260,B44B,EBC9,0015e96913a7,-58,,100,20120731175244,0114")); assertNull(decoder.decode(null, null, "+RESP:GTINF,359464030073766,8938003990320469804f,18,99,100,1,0,+2.00,0,20131018084015,00EE,0103090402")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "+RESP:GTTOW,0F0100,135790246811220,,,10,1,1,4.3,92,70.0,121.354335,31.222073,20090214013254,0460,0000,18d8,6141,00,2000.0,20090214093254,11F0$")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "+RESP:GTDIS,0F0100,135790246811220,,,20,1,1,4.3,92,70.0,121.354335,31.222073,20090214013254,0460,0000,18d8,6141,00,2000.0,20090214093254,11F0$")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "+RESP:GTIOB,0F0100,135790246811220,,,10,1,1,4.3,92,70.0,121.354335,31.222073,20090214013254,0460,0000,18d8,6141,00,2000.0,20090214093254,11F0$")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "+RESP:GTGEO,0F0100,135790246811220,,,00,1,1,4.3,92,70.0,121.354335,31.222073,20090214013254,0460,0000,18d8,6141,00,2000.0,20090214093254,11F0$")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "+RESP:GTSPD,0F0100,135790246811220,,,00,1,1,4.3,92,70.0,121.354335,31.222073,20090214013254,0460,0000,18d8,6141,00,2000.0,20090214093254,11F0$")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "+RESP:GTSOS,0F0100,135790246811220,,,00,1,1,4.3,92,70.0,121.354335,31.222073,20090214013254,0460,0000,18d8,6141,00,2000.0,20090214093254,11F0$")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "+RESP:GTRTL,0F0100,135790246811220,,,00,1,1,4.3,92,70.0,121.354335,31.222073,20090214013254,0460,0000,18d8,6141,00,2000.0,20090214093254,11F0$")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "+RESP:GTDOG,0F0100,135790246811220,,,01,1,1,4.3,92,70.0,121.354335,31.222073,20090214013254,0460,0000,18d8,6141,00,2000.0,20090214093254,11F0$")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "+RESP:GTIGL,0F0100,135790246811220,,,00,1,1,4.3,92,70.0,121.354335,31.222073,20090214013254,0460,0000,18d8,6141,00,2000.0,20090214093254,11F0$")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "+RESP:GTHBM,0F0100,135790246811220,,,10,1,1,4.3,92,70.0,121.354335,31.222073,20090214013254,0460,0000,18d8,6141,00,2000.0,20090214093254,11F0$")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "+RESP:GTHBM,0F0100,135790246811220,,,11,1,1,24.3,92,70.0,121.354335,31.222073,20090214013254,0460,0000,18d8,6141,00,2000.0,20090214093254,11F0$")); } diff --git a/test/org/traccar/protocol/GlobalSatProtocolDecoderTest.java b/test/org/traccar/protocol/GlobalSatProtocolDecoderTest.java index 22c8d5439..f0020f8e2 100644 --- a/test/org/traccar/protocol/GlobalSatProtocolDecoderTest.java +++ b/test/org/traccar/protocol/GlobalSatProtocolDecoderTest.java @@ -1,6 +1,7 @@ package org.traccar.protocol; -import static org.junit.Assert.assertNotNull; +import org.traccar.helper.TestDataManager; +import static org.traccar.helper.DecoderVerifier.verify; import static org.junit.Assert.assertNull; import org.junit.Test; @@ -15,22 +16,22 @@ public class GlobalSatProtocolDecoderTest { assertNull(decoder.decode(null, null, "GSh,131826789036289,3,M,ea04*3d")); //TSPRXAB27GHKLMnaicz - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "GSr,1,135785412249986,01,I,EA02,3,230410,153318,E12129.2839,N2459.8570,0,1.17,212,8,1.0,12.3V*55")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "GSr,GTR-128,012896009148443,0040,5,0080,3,190813,185812,W11203.3661,N3330.2104,344,0.24,78,9,0.8,60%,0,0,12,\"310,410,0bdd,050d,02,21\",\"310,410,0bdd,0639,24,7\"*79")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "$355632004245866,1,1,040202,093633,E12129.2252,N2459.8891,00161,0.0100,147,07,2.4")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "$355632000959420,9,3,160413,230536,E03738.4906,N5546.3148,00000,0.3870,147,07,2.4")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "$353681041893264,9,3,240913,100833,E08513.0122,N5232.9395,181.3,22.02,251.30,9,1.00")); - /*assertNotNull(decoder.decode(null, null, + /*verify(decoder.decode(null, null, "$353681041893264,9,4,230913,052449,\"250,99,B443,422E,42,37\",\"250,99,B443,4232,43,44\",\"250,99,B443,7910,40,32\",\"250,99,B443,B456,40,28\",\"250,99,B443,B455,40,27\""));*/ } diff --git a/test/org/traccar/protocol/GotopProtocolDecoderTest.java b/test/org/traccar/protocol/GotopProtocolDecoderTest.java index 64376a4bb..bc0253e83 100644 --- a/test/org/traccar/protocol/GotopProtocolDecoderTest.java +++ b/test/org/traccar/protocol/GotopProtocolDecoderTest.java @@ -1,6 +1,7 @@ package org.traccar.protocol; -import static org.junit.Assert.assertNotNull; +import org.traccar.helper.TestDataManager; +import static org.traccar.helper.DecoderVerifier.verify; import static org.junit.Assert.assertNull; import org.junit.Test; @@ -14,13 +15,13 @@ public class GotopProtocolDecoderTest { assertNull(decoder.decode(null, null, "")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "013226009991924,CMD-T,A,DATE:130802,TIME:153721,LAT:25.9757433S,LOT:028.1087816E,Speed:000.0,X-X-X-X-81-26,000,65501-00A0-4B8E")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "353327020115804,CMD-T,A,DATE:090329,TIME:223252,LAT:22.7634066N,LOT:114.3964783E,Speed:000.0,84-20,000")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "353327020115804,CMD-T,A,DATE:090329,TIME:223252,LAT:22.7634066N,LOT:114.3964783E,Speed:000.0,1-1-0-84-20,000")); } diff --git a/test/org/traccar/protocol/Gps103ProtocolDecoderTest.java b/test/org/traccar/protocol/Gps103ProtocolDecoderTest.java index 319ccba39..dac14eb2d 100644 --- a/test/org/traccar/protocol/Gps103ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/Gps103ProtocolDecoderTest.java @@ -1,6 +1,7 @@ package org.traccar.protocol; -import static org.junit.Assert.assertNotNull; +import org.traccar.helper.TestDataManager; +import static org.traccar.helper.DecoderVerifier.verify; import static org.junit.Assert.assertNull; import org.junit.Test; @@ -21,78 +22,78 @@ public class Gps103ProtocolDecoderTest { // No GPS signal assertNull(decoder.decode(null, null, "imei:359586015829802,tracker,000000000,13554900601,L,;")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "imei:869039001186913,tracker,1308282156,0,F,215630.000,A,5602.11015,N,9246.30767,E,1.4,,175.9,")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "imei:359710040656622,tracker,13/02/27 23:40,,F,125952.000,A,3450.9430,S,13828.6753,E,0.00,0")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "imei:359710040565419,tracker,13/05/25 14:23,,F,062209.000,A,0626.0411,N,10149.3904,E,0.00,0")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "imei:353451047570260,tracker,1302110948,,F,144807.000,A,0805.6615,S,07859.9763,W,0.00,,")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "imei:359587016817564,tracker,1301251602,,F,080251.000,A,3223.5832,N,11058.9449,W,0.03,")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "imei:012497000208821,tracker,1301080525,,F,212511.000,A,2228.5279,S,06855.6328,W,18.62,268.98,")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "imei:012497000208821,tracker,1301072224,,F,142411.077,A,2227.0739,S,06855.2912,,0,0,")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "imei:012497000431811,tracker,1210260609,,F,220925.000,A,0845.5500,N,07024.7673,W,0.00,,")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "imei:100000000000000,help me,1004171910,,F,010203.000,A,0102.0003,N,00102.0003,E,1.02,")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "imei:353451040164707,tracker,1105182344,+36304665439,F,214418.000,A,4804.2222,N,01916.7593,E,0.37,")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "imei:353451042861763,tracker,1106132241,,F,144114.000,A,2301.9052,S,04909.3676,W,0.13,")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "imei:359587010124900,tracker,0809231929,13554900601,F,112909.397,A,2234.4669,N,11354.3287,E,0.11,321.53,")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "imei:353451049926460,tracker,1208042043,123456 99008026,F,124336.000,A,3509.8668,N,03322.7636,E,0.00,,")); // SOS alarm - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "imei:359586015829802,help me,0809231429,13554900601,F,062947.294,A,2234.4026,N,11354.3277,E,0.00,")); // Low battery alarm - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "imei:359586015829802,low battery,0809231429,13554900601,F,062947.294,A,2234.4026,N,11354.3277,E,0.00,")); // Geo-fence alarm - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "imei:359586015829802,stockade,0809231429,13554900601,F,062947.294,A,2234.4026,N,11354.3277,E,0.00,")); // Move alarm - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "imei:359586015829802,move,0809231429,13554900601,F,062947.294,A,2234.4026,N,11354.3277,E,0.00,")); // Over speed alarm - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "imei:359586015829802,speed,0809231429,13554900601,F,062947.294,A,2234.4026,N,11354.3277,E,0.00,")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "imei:863070010423167,tracker,1211051840,,F,104000.000,A,2220.6483,N,11407.6377,,0,0,")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "imei:863070010423167,tracker,1211051951,63360926,F,115123.000,A,2220.6322,N,11407.5313,E,0.00,,")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "imei:863070010423167,tracker,1211060621,,F,062152.000,A,2220.6914,N,11407.5506,E,15.85,347.84,")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "imei:863070012698733,tracker,1303092334,,F,193427.000,A,5139.0369,N,03907.2791,E,0.00,,")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "imei:869039001186913,tracker,130925065533,0,F,065533.000,A,5604.11015,N,9232.12238,E,0.0,,329.0,")); } diff --git a/test/org/traccar/protocol/GpsGateProtocolDecoderTest.java b/test/org/traccar/protocol/GpsGateProtocolDecoderTest.java index 9e6bb405f..5fbabbb00 100644 --- a/test/org/traccar/protocol/GpsGateProtocolDecoderTest.java +++ b/test/org/traccar/protocol/GpsGateProtocolDecoderTest.java @@ -1,6 +1,7 @@ package org.traccar.protocol; -import static org.junit.Assert.assertNotNull; +import org.traccar.helper.TestDataManager; +import static org.traccar.helper.DecoderVerifier.verify; import static org.junit.Assert.assertNull; import org.junit.Test; @@ -18,7 +19,7 @@ public class GpsGateProtocolDecoderTest { assertNull(decoder.decode(null, null, "$FRLIN,IMEI,1234123412341234,*7B")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "$GPRMC,154403.000,A,6311.64120,N,01438.02740,E,0.000,0.0,270707,,*0A")); } diff --git a/test/org/traccar/protocol/Gt02ProtocolDecoderTest.java b/test/org/traccar/protocol/Gt02ProtocolDecoderTest.java index 19d7f3812..54a5d90c3 100644 --- a/test/org/traccar/protocol/Gt02ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/Gt02ProtocolDecoderTest.java @@ -1,7 +1,8 @@ package org.traccar.protocol; +import org.traccar.helper.TestDataManager; import org.jboss.netty.buffer.ChannelBuffers; -import static org.junit.Assert.assertNotNull; +import static org.traccar.helper.DecoderVerifier.verify; import org.junit.Test; public class Gt02ProtocolDecoderTest { @@ -13,7 +14,7 @@ public class Gt02ProtocolDecoderTest { decoder.setDataManager(new TestDataManager()); byte[] buf1 = {0x68,0x68,0x25,0x00,0x00,0x01,0x23,0x45,0x67,(byte)0x89,0x01,0x23,0x45,0x00,0x01,0x10,0x01,0x01,0x01,0x01,0x01,0x01,0x02,0x6B,0x3F,0x3E,0x02,0x6B,0x3F,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x0D,0x0A}; - assertNotNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(buf1))); + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(buf1))); } diff --git a/test/org/traccar/protocol/Gt06ProtocolDecoderTest.java b/test/org/traccar/protocol/Gt06ProtocolDecoderTest.java index a6822e23c..2916b9654 100644 --- a/test/org/traccar/protocol/Gt06ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/Gt06ProtocolDecoderTest.java @@ -1,7 +1,8 @@ package org.traccar.protocol; +import org.traccar.helper.TestDataManager; import org.jboss.netty.buffer.ChannelBuffers; -import static org.junit.Assert.assertNotNull; +import static org.traccar.helper.DecoderVerifier.verify; import static org.junit.Assert.assertNull; import org.junit.Test; @@ -17,7 +18,7 @@ public class Gt06ProtocolDecoderTest { assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(buf1))); byte[] buf2 = {0x78,0x78,0x1F,0x12,0x0B,0x08,0x1D,0x11,0x2E,0x10,(byte)0xCC,0x02,0x7A,(byte)0xC7,(byte)0xEB,0x0C,0x46,0x58,0x49,0x00,0x14,(byte)0x8F,0x01,(byte)0xCC,0x00,0x28,0x7D,0x00,0x1F,(byte)0xB8,0x00,0x03,(byte)0x80,(byte)0x81,0x0D,0x0A}; - assertNotNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(buf2))); + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(buf2))); byte[] buf3 = {0x78,0x78,0x0D,0x01,0x08,0x64,0x71,0x70,0x03,0x28,0x35,(byte)0x81,0x00,0x09,0x3F,0x04,0x0D,0x0A}; assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(buf3))); @@ -29,13 +30,13 @@ public class Gt06ProtocolDecoderTest { assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(buf5))); byte[] buf6 = {0x78,0x78,0x19,0x10,0x0B,0x03,0x1A,0x0B,0x1B,0x31,(byte)0xCC,0x02,0x7A,(byte)0xC7,(byte)0xFD,0x0C,0x46,0x57,(byte)0xBF,0x01,0x15,0x21,0x00,0x01,0x00,0x1C,(byte)0xC6,0x07,0x0D,0x0A}; - assertNotNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(buf6))); + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(buf6))); byte[] buf7 = {78,0x78,0x21,0x12,0x0C,0x01,0x0C,0x0F,0x15,0x1F,(byte)0xCF,0x02,0x7A,(byte)0xC8,(byte)0x84,0x0C,0x46,0x57,(byte)0xEC,0x00,0x14,0x00,0x01,(byte)0xCC,0x00,0x28,0x7D,0x00,0x1F,0x72,0x00,0x01,0x00,0x0F,0x53,(byte)0xA0,0x0D,0x0A}; - assertNotNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(buf7))); + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(buf7))); byte[] buf8 = {0x78,0x78,0x25,0x16,0x0B,0x05,0x1B,0x09,0x35,0x23,(byte)0xCF,0x02,0x7A,(byte)0xC8,0x36,0x0C,0x46,0x57,(byte)0xB3,0x00,0x14,0x00,0x09,0x01,(byte)0xCC,0x00,0x26,0x6A,0x00,0x1E,0x17,0x40,0x05,0x04,0x00,0x02,0x00,0x08,(byte)0xD7,(byte)0xB1,0x0D,0x0A}; - assertNotNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(buf8))); + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(buf8))); } diff --git a/test/org/traccar/protocol/H02ProtocolDecoderTest.java b/test/org/traccar/protocol/H02ProtocolDecoderTest.java index 3b4233752..3ad601cc9 100644 --- a/test/org/traccar/protocol/H02ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/H02ProtocolDecoderTest.java @@ -1,8 +1,9 @@ package org.traccar.protocol; +import org.traccar.helper.TestDataManager; import java.nio.charset.Charset; import org.jboss.netty.buffer.ChannelBuffers; -import static org.junit.Assert.assertNotNull; +import static org.traccar.helper.DecoderVerifier.verify; import static org.junit.Assert.assertNull; import org.junit.Test; import org.traccar.helper.ChannelBufferTools; @@ -18,68 +19,68 @@ public class H02ProtocolDecoderTest { assertNull(decoder.decode(null, null, ChannelBuffers.copiedBuffer( "*HQ,353588020068342,V1,000000,V,0.0000,0,0.0000,0,0.00,0.00,000000,ffffffff,000106,000002,000203,004c87,16#", Charset.defaultCharset()))); - assertNotNull(decoder.decode(null, null, ChannelBuffers.copiedBuffer( + verify(decoder.decode(null, null, ChannelBuffers.copiedBuffer( "*HQ,3800008786,V1,062507,V,3048.2437,N,03058.5617,E,000.00,000,250413,FFFFFBFF#", Charset.defaultCharset()))); - assertNotNull(decoder.decode(null, null, ChannelBuffers.copiedBuffer( + verify(decoder.decode(null, null, ChannelBuffers.copiedBuffer( "*HQ,4300256455,V1,111817,A,1935.5128,N,04656.3243,E,0.00,100,170913,FFE7FBFF#", Charset.defaultCharset()))); - assertNotNull(decoder.decode(null, null, ChannelBuffers.copiedBuffer( + verify(decoder.decode(null, null, ChannelBuffers.copiedBuffer( "*HQ,123456789012345,V1,155850,A,5214.5346,N,2117.4683,E,0.00,270.90,131012,ffffffff,000000,000000,000000,000000#", Charset.defaultCharset()))); - assertNotNull(decoder.decode(null, null, ChannelBuffers.copiedBuffer( + verify(decoder.decode(null, null, ChannelBuffers.copiedBuffer( "*HQ,353588010001689,V1,221116,A,1548.8220,S,4753.1679,W,0.00,0.00,300413,ffffffff,0002d4,000004,0001cd,000047#", Charset.defaultCharset()))); - assertNotNull(decoder.decode(null, null, ChannelBuffers.copiedBuffer( + verify(decoder.decode(null, null, ChannelBuffers.copiedBuffer( "*HQ,354188045498669,V1,195200,A,701.8915,S,3450.3399,W,0.00,205.70,050213,ffffffff,000243,000000,000000#", Charset.defaultCharset()))); - assertNotNull(decoder.decode(null, null, ChannelBuffers.copiedBuffer( + verify(decoder.decode(null, null, ChannelBuffers.copiedBuffer( "*HQ,2705171109,V1,213324,A,5002.5849,N,01433.7822,E,0.00,000,140613,FFFFFFFF#", Charset.defaultCharset()))); - assertNotNull(decoder.decode(null, null, ChannelBuffers.copiedBuffer( + verify(decoder.decode(null, null, ChannelBuffers.copiedBuffer( "*TH,2020916012,V1,050316,A,2212.8745,N,11346.6574,E,14.28,028,220902,FFFFFBFF#", Charset.defaultCharset()))); - assertNotNull(decoder.decode(null, null, ChannelBuffers.copiedBuffer( + verify(decoder.decode(null, null, ChannelBuffers.copiedBuffer( "*TH,2020916012,V4,S17,130305,050316,A,2212.8745,N,11346.6574,E,14.28,028,220902,FFFFFBFF#", Charset.defaultCharset()))); - assertNotNull(decoder.decode(null, null, ChannelBuffers.copiedBuffer( + verify(decoder.decode(null, null, ChannelBuffers.copiedBuffer( "*TH,2020916012,V4,S14,100,10,1,3,130305,050316,A,2212.8745,N,11346.6574,E,14.28,028,220902,FFFFFBFF#", Charset.defaultCharset()))); - assertNotNull(decoder.decode(null, null, ChannelBuffers.copiedBuffer( + verify(decoder.decode(null, null, ChannelBuffers.copiedBuffer( "*TH,2020916012,V4,S20,ERROR,130305,050316,A,2212.8745,N,11346.6574,E,14.28,028,220902,FFFFFBFF#", Charset.defaultCharset()))); - assertNotNull(decoder.decode(null, null, ChannelBuffers.copiedBuffer( + verify(decoder.decode(null, null, ChannelBuffers.copiedBuffer( "*TH,2020916012,V4,S20,DONE,130305,050316,A,2212.8745,N,11346.6574,E,14.28,028,220902,F7FFFBFF#", Charset.defaultCharset()))); - assertNotNull(decoder.decode(null, null, ChannelBuffers.copiedBuffer( + verify(decoder.decode(null, null, ChannelBuffers.copiedBuffer( "*TH,2020916012,V4,R8,ERROR,130305,050316,A,2212.8745,N,11346.6574,E,14.28,028,220902,FFFFFBFF#", Charset.defaultCharset()))); - assertNotNull(decoder.decode(null, null, ChannelBuffers.copiedBuffer( + verify(decoder.decode(null, null, ChannelBuffers.copiedBuffer( "*TH,2020916012,V4,S23,165.165.33.250:8800,130305,050316,A,2212.8745,N,11346.6574,E,14.28,028,220902,FFFFFBFF#", Charset.defaultCharset()))); - assertNotNull(decoder.decode(null, null, ChannelBuffers.copiedBuffer( + verify(decoder.decode(null, null, ChannelBuffers.copiedBuffer( "*TH,2020916012,V4,S24,thit.gd,130305,050316,A,2212.8745,N,11346.6574,E,14.28,028,220902,FFFFFBFF#", Charset.defaultCharset()))); - assertNotNull(decoder.decode(null, null, ChannelBuffers.copiedBuffer( + verify(decoder.decode(null, null, ChannelBuffers.copiedBuffer( "*TH,2020916012,V4,S1,OK,pass_word,130305,050316,A,2212.8745,N,11346.6574,E,14.28,028,220902,FFFFFBFD#", Charset.defaultCharset()))); - assertNotNull(decoder.decode(null, null, ChannelBuffers.copiedBuffer( + verify(decoder.decode(null, null, ChannelBuffers.copiedBuffer( "*HQ,353588020068342,V1,062840,A,5241.1249,N,954.9490,E,0.00,0.00,231013,ffffffff,000106,000002,000203,004c87,24#", Charset.defaultCharset()))); - assertNotNull(decoder.decode(null, null, ChannelBuffers.copiedBuffer( + verify(decoder.decode(null, null, ChannelBuffers.copiedBuffer( "*HQ,353505220903211,V1,075228,A,5227.5039,N,01032.8443,E,0.00,0,231013,FFFBFFFF,106,14, 201,2173#", Charset.defaultCharset()))); - assertNotNull(decoder.decode(null, null, ChannelBuffers.copiedBuffer( + verify(decoder.decode(null, null, ChannelBuffers.copiedBuffer( "*HQ,353505220903211,V1,140817,A,5239.3538,N,01003.5292,E,21.03,312,221013,FFFBFFFF,106,14, 203,1cd#", Charset.defaultCharset()))); int[] buf1 = {0x24,0x27,0x05,0x17,0x11,0x09,0x21,0x33,0x39,0x14,0x06,0x13,0x50,0x02,0x58,0x49,0x00,0x01,0x43,0x37,0x82,0x2e,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0x00,0x00}; - assertNotNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray(buf1)))); + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray(buf1)))); int[] buf2 = {0x24,0x27,0x05,0x17,0x11,0x09,0x21,0x34,0x09,0x14,0x06,0x13,0x50,0x02,0x58,0x49,0x00,0x01,0x43,0x37,0x82,0x2e,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0x00,0x00}; - assertNotNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray(buf2)))); + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray(buf2)))); int[] buf3 = {0x24,0x10,0x30,0x73,0x10,0x01,0x05,0x03,0x16,0x22,0x09,0x02,0x22,0x12,0x87,0x45,0x00,0x11,0x34,0x66,0x57,0x4C,0x01,0x40,0x28,0xff,0xff,0xfb,0xff,0xff,0x00,0x00}; - assertNotNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray(buf3)))); + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray(buf3)))); } diff --git a/test/org/traccar/protocol/IntellitracProtocolDecoderTest.java b/test/org/traccar/protocol/IntellitracProtocolDecoderTest.java index 22f4f8463..351b6136d 100644 --- a/test/org/traccar/protocol/IntellitracProtocolDecoderTest.java +++ b/test/org/traccar/protocol/IntellitracProtocolDecoderTest.java @@ -1,6 +1,7 @@ package org.traccar.protocol; -import static org.junit.Assert.assertNotNull; +import org.traccar.helper.TestDataManager; +import static org.traccar.helper.DecoderVerifier.verify; import static org.junit.Assert.assertNull; import org.junit.Test; @@ -14,37 +15,37 @@ public class IntellitracProtocolDecoderTest { assertNull(decoder.decode(null, null, "$OK:TRACKING")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "1010000002,20030217132813,121.646060,25.061725,20,157,133,7,0,11,15,0.096,0.000")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "1001070919,20130405084206,37.903730,48.011377,0,0,235,10,2,2,0,20.211,0.153")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "1010000002,20030217144230,121.646102,25.061398,0,0,139,0,0,0,0,0.093,0.000")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "1010000004,20050513153524,121.646075,25.063675,0,166,50,6,1,0,0,0.118,0.000")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "1010000004,20050513154001,121.646075,25.063675,0,166,55,7,1,0,0,0.096,0.000")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "1010000002,20030217132813,121.646060,25.061725,20,157,0,7,0,11,15")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "12345,1010000002,20030217132813,121.646060,25.061725,20,157,0,7,0,11,15")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "1010000002,20030217144230,121.646102,25.061398,0,0,0,7,2,0,0")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "$RP:12345,1010000002,20030217144230,121.646102,25.061398,0,0,0,7,2,0,0")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "1010000001,20030105092129,121.651598,25.052325,0,0,33,0,1,0,0")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "1010000001,20030105092129,-121.651598,-25.052325,0,0,33,0,1,0,0")); } diff --git a/test/org/traccar/protocol/Jt600ProtocolDecoderTest.java b/test/org/traccar/protocol/Jt600ProtocolDecoderTest.java index a1c090cbb..d4b1a38f6 100644 --- a/test/org/traccar/protocol/Jt600ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/Jt600ProtocolDecoderTest.java @@ -1,8 +1,9 @@ package org.traccar.protocol; +import org.traccar.helper.TestDataManager; import java.nio.charset.Charset; import org.jboss.netty.buffer.ChannelBuffers; -import static org.junit.Assert.assertNotNull; +import static org.traccar.helper.DecoderVerifier.verify; import org.junit.Test; public class Jt600ProtocolDecoderTest { @@ -14,24 +15,24 @@ public class Jt600ProtocolDecoderTest { decoder.setDataManager(new TestDataManager()); byte[] buf1 = {0x24,0x31,0x10,0x21,0x60,0x01,0x11,0x00,0x1B,0x16,0x02,0x11,0x05,0x59,0x10,0x22,0x32,(byte)0x98,0x62,0x11,0x40,0x46,0x22,0x7B,0x05,(byte)0x98,0x09,0x50,(byte)0x80,0x01,0x23,0x27,(byte)0x95,0x14,0x35,0x16,0x1F}; - assertNotNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(buf1))); + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(buf1))); byte[] buf2 = {0x24,0x31,0x20,(byte)0x82,0x00,0x29,0x11,0x00,0x1B,0x17,0x10,0x12,0x05,0x28,0x31,0x24,0x38,0x10,0x12,0x02,0x55,0x33,0x64,0x25,0x00,0x19,0x07,0x19,0x00,0x03,(byte)0xFD,0x2B,(byte)0x91,0x04,0x4D,0x1F,(byte)0xA0}; - assertNotNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(buf2))); + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(buf2))); byte[] buf3 = {0x24,0x31,0x20,(byte)0x82,0x00,0x29,0x11,0x00,0x1B,0x17,0x10,0x12,0x05,0x33,0x05,0x24,0x38,0x09,(byte)0x97,0x02,0x55,0x33,0x58,0x45,0x00,0x04,0x06,0x1E,0x00,0x03,(byte)0xEE,0x00,0x00,0x00,0x00,0x0C,0x00}; - assertNotNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(buf3))); + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(buf3))); byte[] buf4 = {0x24,0x60,(byte)0x81,0x11,(byte)0x88,(byte)0x88,0x21,0x00,0x1B,0x09,0x06,0x09,0x08,0x04,0x53,0x22,0x56,0x40,0x25,0x11,0x32,0x42,0x32,(byte)0x9F,0x05,(byte)0x98,0x00,0x00,0x01,0x00,0x3F,0x00,0x00,0x00,0x2D,0x00,(byte)0xAB}; - assertNotNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(buf4))); + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(buf4))); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, ChannelBuffers.copiedBuffer("(3110312099,W01,11404.6204,E,2232.9961,N,A,040511,063736,4,7,100,4,17,1,1,company)", Charset.defaultCharset()))); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, ChannelBuffers.copiedBuffer("(3120820029,W01,02553.3555,E,2438.0997,S,A,171012,053339,0,8,20,6,31,5,20,20)", Charset.defaultCharset()))); - /*assertNotNull(decoder.decode(null, null, + /*verify(decoder.decode(null, null, ChannelBuffers.copiedBuffer("(6221107674,2,U09,129,2,A,280513113036,E,02711.0500,S,1721.0876,A,030613171243,E,02756.7618,S,2300.0325,3491,538200,14400,1)", Charset.defaultCharset())));*/ } diff --git a/test/org/traccar/protocol/LaipacProtocolDecoderTest.java b/test/org/traccar/protocol/LaipacProtocolDecoderTest.java index bd8059ea5..f6bdf5d9e 100644 --- a/test/org/traccar/protocol/LaipacProtocolDecoderTest.java +++ b/test/org/traccar/protocol/LaipacProtocolDecoderTest.java @@ -1,6 +1,7 @@ package org.traccar.protocol; -import static org.junit.Assert.assertNotNull; +import org.traccar.helper.TestDataManager; +import static org.traccar.helper.DecoderVerifier.verify; import static org.junit.Assert.assertNull; import org.junit.Test; @@ -16,31 +17,31 @@ public class LaipacProtocolDecoderTest { assertNull(decoder.decode(null, null, "$ECHK,99999999,0*35")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "$AVRMC,99999999,164339,A,4351.0542,N,07923.5445,W,0.29,78.66,180703,0,3.727,17,1,0,0*37")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "$AVRMC,99999999,164339,a,4351.0542,N,07923.5445,W,0.29,78.66,180703,0,3.727,17,1,0,0*17")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "$AVRMC,99999999,164339,v,4351.0542,N,07923.5445,W,0.29,78.66,180703,0,3.727,17,1,0,0*00")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "$AVRMC,99999999,164339,r,4351.0542,N,07923.5445,W,0.29,78.66,180703,0,3.727,17,1,0,0*04")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "$AVRMC,99999999,164339,A,4351.0542,N,07923.5445,W,0.29,78.66,180703,S,3.727,17,1,0,0*54")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "$AVRMC,99999999,164339,A,4351.0542,N,07923.5445,W,0.29,78.66,180703,T,3.727,17,1,0,0*53")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "$AVRMC,99999999,164339,A,4351.0542,N,07923.5445,W,0.29,78.66,180703,3,3.727,17,1,0,0*34")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "$AVRMC,99999999,164339,A,4351.0542,N,07923.5445,W,0.29,78.66,180703,X,3.727,17,1,0,0*5F")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "$AVRMC,99999999,164339,A,4351.0542,N,07923.5445,W,0.29,78.66,180703,4,3.727,17,1,0,0*33")); } diff --git a/test/org/traccar/protocol/M2mProtocolDecoderTest.java b/test/org/traccar/protocol/M2mProtocolDecoderTest.java index 3ea2131c9..097a783bc 100644 --- a/test/org/traccar/protocol/M2mProtocolDecoderTest.java +++ b/test/org/traccar/protocol/M2mProtocolDecoderTest.java @@ -1,7 +1,8 @@ package org.traccar.protocol; +import org.traccar.helper.TestDataManager; import org.jboss.netty.buffer.ChannelBuffers; -import static org.junit.Assert.assertNotNull; +import static org.traccar.helper.DecoderVerifier.verify; import static org.junit.Assert.assertNull; import org.junit.Test; import org.traccar.helper.ChannelBufferTools; @@ -18,7 +19,7 @@ public class M2mProtocolDecoderTest { assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray(buf1)))); int[] buf2 = {0xA6,0xE1,0x2C,0x2A,0xAA,0xDA,0x46,0x28,0x32,0x6B,0x20,0x59,0x57,0x6E,0x30,0x20,0x2A,0x2F,0xE8,0x5D,0x20,0x20,0x0B}; - assertNotNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray(buf2)))); + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray(buf2)))); } diff --git a/test/org/traccar/protocol/ManPowerProtocolDecoderTest.java b/test/org/traccar/protocol/ManPowerProtocolDecoderTest.java index 02db3276b..eba2bc3f0 100644 --- a/test/org/traccar/protocol/ManPowerProtocolDecoderTest.java +++ b/test/org/traccar/protocol/ManPowerProtocolDecoderTest.java @@ -1,6 +1,7 @@ package org.traccar.protocol; -import static org.junit.Assert.assertNotNull; +import org.traccar.helper.TestDataManager; +import static org.traccar.helper.DecoderVerifier.verify; import org.junit.Test; public class ManPowerProtocolDecoderTest { @@ -11,13 +12,13 @@ public class ManPowerProtocolDecoderTest { ManPowerProtocolDecoder decoder = new ManPowerProtocolDecoder(null); decoder.setDataManager(new TestDataManager()); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "simei:352581250259539,,,tracker,51,24,1.73,130426023608,A,3201.5462,N,03452.2975,E,0.01,28B9,1DED,425,01,1x0x0*0x1*60x+2,en-us,")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "simei:352581250259539,,,weather,99,20,0.00,130426032310,V,3201.5517,N,03452.3064,E,1.24,28B9,25A1,425,01,1x0x0*0x1*60x+2,en-us,")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "simei:352581250259539,,,SMS,54,19,90.41,130426172308,V,3201.5523,N,03452.2705,E,0.14,28B9,01A5,425,01,1x0x0*0x1*60x+2,en-us,")); } diff --git a/test/org/traccar/protocol/MegastekProtocolDecoderTest.java b/test/org/traccar/protocol/MegastekProtocolDecoderTest.java index d1cb945a6..a157f01c0 100644 --- a/test/org/traccar/protocol/MegastekProtocolDecoderTest.java +++ b/test/org/traccar/protocol/MegastekProtocolDecoderTest.java @@ -1,6 +1,7 @@ package org.traccar.protocol; -import static org.junit.Assert.assertNotNull; +import org.traccar.helper.TestDataManager; +import static org.traccar.helper.DecoderVerifier.verify; import org.junit.Test; public class MegastekProtocolDecoderTest { @@ -11,22 +12,22 @@ public class MegastekProtocolDecoderTest { MegastekProtocolDecoder decoder = new MegastekProtocolDecoder(null); decoder.setDataManager(new TestDataManager()); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "STX,GerAL22,$GPRMC,174752.000,A,3637.060059,S,6416.2354,W,0.00,0.00,030812,,,A*55,F,,imei:861785000249353,05,180.6,Battery=100%,,1,722,310,0FA6,39D0;8F")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "STX,GerAL22,$GPRMC,000051.000,A,3637.079590,S,6416.2148,W,1.72,332.98,010109,,,A*52,L,,imei:861785000249353,03,275.3,Battery=68%,,1,722,07,0515,1413;41")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "STX,102110830074542,$GPRMC,114229.000,A,2238.2024,N,11401.9619,E,0.00,0.00,310811,,,A*64,F,LowBattery,imei:012207005553885,03,113.1,Battery=24%,,1,460,01,2531,647E;57")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "STX863070014949464 $GPRMC,215942.290,A,4200.1831,N,02128.5904,E,003.1,079.8,090813,,,A*6E,294,02,0064,0F3D,18,17,0000,000000,0000,0.00,0.02,0.00,Store;D8")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "STX123456 $GPRMC,063709.000,A,2238.1998,N,11401.9670,E,0.00,,250313,,,A*7F,460,01,2531,647E,11,87,1000,001001,0000,0.00,0.02,0.00,Timer;4A")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "STX260475 $GPRMC,104032.001,A,4022.1119,N,01811.4081,E,000.0,000.0,060913,,,A*67,222,01,815A,D455,11,99,0000,0001,0,Timer;")); } diff --git a/test/org/traccar/protocol/MeiligaoProtocolDecoderTest.java b/test/org/traccar/protocol/MeiligaoProtocolDecoderTest.java index f053061e3..80da07a14 100644 --- a/test/org/traccar/protocol/MeiligaoProtocolDecoderTest.java +++ b/test/org/traccar/protocol/MeiligaoProtocolDecoderTest.java @@ -1,9 +1,10 @@ package org.traccar.protocol; +import org.traccar.helper.TestDataManager; import org.jboss.netty.buffer.ChannelBufferFactory; import org.jboss.netty.buffer.ChannelBuffers; import org.jboss.netty.buffer.HeapChannelBufferFactory; -import static org.junit.Assert.assertNotNull; +import static org.traccar.helper.DecoderVerifier.verify; import static org.junit.Assert.assertNull; import org.junit.Test; import org.traccar.helper.ChannelBufferTools; @@ -21,34 +22,34 @@ public class MeiligaoProtocolDecoderTest { assertNull(decoder.decode(null, null, factory.getBuffer(buf1, 0, buf1.length))); byte[] buf2 = {0x12,0x34,0x56,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0x99,0x55,0x30,0x33,0x35,0x36,0x34,0x34,0x2E,0x30,0x30,0x30,0x2C,0x41,0x2C,0x32,0x32,0x33,0x32,0x2E,0x36,0x30,0x38,0x33,0x2C,0x4E,0x2C,0x31,0x31,0x34,0x30,0x34,0x2E,0x38,0x31,0x33,0x37,0x2C,0x45,0x2C,0x30,0x2E,0x30,0x30,0x2C,0x2C,0x30,0x31,0x30,0x38,0x30,0x39,0x2C,0x2C,0x2A,0x31,0x43,0x7C,0x31,0x31,0x2E,0x35,0x7C,0x31,0x39,0x34,0x7C,0x30,0x30,0x30,0x30,0x7C,0x30,0x30,0x30,0x30,0x2C,0x30,0x30,0x30,0x30,0x69,0x62,0x0D,0x0A}; - assertNotNull(decoder.decode(null, null, factory.getBuffer(buf2, 0, buf2.length))); + verify(decoder.decode(null, null, factory.getBuffer(buf2, 0, buf2.length))); byte[] buf3 = {0x33,0x58,0x01,(byte)0x97,0x03,0x58,0x1F,(byte)0x99,0x55,0x31,0x33,0x34,0x33,0x35,0x31,0x2E,0x30,0x30,0x30,0x2C,0x41,0x2C,0x30,0x39,0x32,0x35,0x2E,0x35,0x30,0x32,0x35,0x2C,0x4E,0x2C,0x30,0x36,0x39,0x31,0x34,0x2E,0x38,0x31,0x30,0x37,0x2C,0x57,0x2C,0x30,0x2E,0x30,0x30,0x2C,0x32,0x33,0x2C,0x33,0x30,0x31,0x30,0x31,0x32,0x2C,0x2C,0x2A,0x32,0x43,0x7C,0x30,0x2E,0x38,0x7C,0x31,0x38,0x36,0x7C,0x32,0x30,0x30,0x30,0x7C,0x30,0x31,0x32,0x36,0x2C,0x30,0x30,0x46,0x46,0x7C,0x30,0x32,0x44,0x45,0x30,0x30,0x30,0x32,0x44,0x38,0x43,0x44,0x42,0x34,0x31,0x35,0x7C,0x30,0x36,0x7C,0x30,0x30,0x46,0x44,0x36,0x42,0x37,0x39,(byte)0x95,(byte)0x82,0x0D,0x0A}; - assertNotNull(decoder.decode(null, null, factory.getBuffer(buf3, 0, buf3.length))); + verify(decoder.decode(null, null, factory.getBuffer(buf3, 0, buf3.length))); byte[] buf4 = {0x16,(byte)0x91,0x00,0x04,(byte)0x84,0x12,0x4F,(byte)0x99,0x55,0x31,0x34,0x30,0x36,0x30,0x33,0x2E,0x30,0x30,0x30,0x2C,0x41,0x2C,0x30,0x39,0x33,0x34,0x2E,0x32,0x35,0x35,0x34,0x2C,0x4E,0x2C,0x30,0x36,0x39,0x31,0x33,0x2E,0x30,0x39,0x36,0x36,0x2C,0x57,0x2C,0x30,0x2E,0x30,0x30,0x2C,0x2C,0x33,0x30,0x31,0x30,0x31,0x32,0x2C,0x2C,0x2A,0x30,0x32,0x7C,0x30,0x2E,0x38,0x7C,0x32,0x30,0x37,0x7C,0x30,0x30,0x30,0x30,(byte)0xFA,0x42,0x0D,0x0A}; - assertNotNull(decoder.decode(null, null, factory.getBuffer(buf4, 0, buf4.length))); + verify(decoder.decode(null, null, factory.getBuffer(buf4, 0, buf4.length))); byte[] buf5 = {0x45,0x12,0x42,0x20,0x30,0x6F,(byte)0xFF,(byte)0x99,(byte)0x99,0x14,0x31,0x35,0x35,0x34,0x32,0x32,0x2E,0x30,0x30,0x30,0x2C,0x56,0x2C,0x32,0x32,0x33,0x30,0x2E,0x37,0x36,0x32,0x33,0x2C,0x4E,0x2C,0x31,0x31,0x34,0x30,0x33,0x2E,0x34,0x32,0x31,0x38,0x2C,0x45,0x2C,0x30,0x2E,0x30,0x30,0x2C,0x30,0x2C,0x30,0x36,0x30,0x32,0x31,0x31,0x2C,0x2C,0x2A,0x31,0x41,0x7C,0x30,0x2E,0x30,0x7C,0x32,0x36,0x7C,0x30,0x30,0x30,0x30,0x7C,0x30,0x30,0x30,0x30,0x2C,0x30,0x30,0x30,0x30,0x7C,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x7C,0x36,0x33,0x7C,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,(byte)0xBA,(byte)0xC1,0x0D,0x0A}; - assertNotNull(decoder.decode(null, null, factory.getBuffer(buf5, 0, buf5.length))); + verify(decoder.decode(null, null, factory.getBuffer(buf5, 0, buf5.length))); byte[] buf6 = {(byte)0x86,0x21,0x70,0x01,0x42,0x45,(byte)0x8F,(byte)0x99,(byte)0x99,0x50,0x31,0x39,0x32,0x39,0x35,0x38,0x2E,0x30,0x30,0x30,0x2C,0x41,0x2C,0x33,0x36,0x32,0x37,0x2E,0x31,0x36,0x39,0x39,0x2C,0x4E,0x2C,0x30,0x31,0x30,0x34,0x33,0x2E,0x35,0x36,0x32,0x37,0x2C,0x45,0x2C,0x30,0x2E,0x30,0x30,0x2C,0x32,0x33,0x39,0x2C,0x30,0x39,0x31,0x32,0x31,0x32,0x2C,0x2C,0x2A,0x30,0x46,0x7C,0x31,0x2E,0x30,0x7C,0x37,0x7C,0x30,0x30,0x30,0x30,0x7C,0x30,0x31,0x41,0x39,0x2C,0x30,0x31,0x39,0x37,0x7C,0x30,0x32,0x35,0x44,0x30,0x30,0x30,0x32,0x30,0x30,0x35,0x41,0x38,0x36,0x39,0x46,0x7C,0x31,0x32,0x7C,0x30,0x30,0x30,0x33,0x33,0x42,0x42,0x33,(byte)0xE2,0x48,0x0D,0x0A}; - assertNotNull(decoder.decode(null, null, factory.getBuffer(buf6, 0, buf6.length))); + verify(decoder.decode(null, null, factory.getBuffer(buf6, 0, buf6.length))); byte[] buf7 = {0x12,0x34,0x56,0x78,(byte)0x9F,(byte)0xFF,(byte)0xFF,(byte)0x99,0x55,0x30,0x32,0x30,0x36,0x30,0x30,0x2E,0x39,0x33,0x30,0x2C,0x41,0x2C,0x32,0x33,0x30,0x39,0x2E,0x32,0x30,0x35,0x31,0x2C,0x4E,0x2C,0x31,0x31,0x33,0x31,0x38,0x2E,0x38,0x34,0x34,0x39,0x2C,0x45,0x2C,0x30,0x2E,0x30,0x30,0x2C,0x30,0x2E,0x30,0x30,0x2C,0x30,0x39,0x30,0x37,0x31,0x30,0x2C,0x2C,0x2C,0x41,0x2A,0x36,0x41,0x7C,0x32,0x2E,0x36,0x7C,0x39,0x36,0x2E,0x37,0x7C,0x30,0x30,0x30,0x30,0x7C,0x30,0x30,0x30,0x30,0x2C,0x33,0x46,0x46,0x46,0x7C,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,(byte)0xC4,0x52,0x0D,0x0A}; - assertNotNull(decoder.decode(null, null, factory.getBuffer(buf7, 0, buf7.length))); + verify(decoder.decode(null, null, factory.getBuffer(buf7, 0, buf7.length))); byte[] buf8 = {0x59,0x77,0x20,0x37,0x44,0x05,(byte)0x84,(byte)0x99,0x55,0x30,0x32,0x30,0x31,0x31,0x37,0x2E,0x30,0x30,0x30,0x2C,0x41,0x2C,0x34,0x31,0x31,0x37,0x2E,0x39,0x32,0x31,0x32,0x2C,0x4E,0x2C,0x30,0x38,0x31,0x33,0x30,0x2E,0x32,0x30,0x39,0x36,0x2C,0x57,0x2C,0x30,0x2E,0x30,0x30,0x2C,0x33,0x30,0x33,0x2E,0x38,0x35,0x2C,0x32,0x36,0x30,0x32,0x31,0x33,0x7C,0x31,0x2E,0x36,0x7C,0x30,0x30,0x7C,0x30,0x30,0x30,0x30,0x7C,0x30,0x30,0x30,0x30,0x2C,0x30,0x30,0x30,0x30,0x71,(byte)0xCD,0x0D,0x0A}; - decoder.decode(null, null, factory.getBuffer(buf8, 0, buf8.length)); + verify(decoder.decode(null, null, factory.getBuffer(buf8, 0, buf8.length))); byte[] buf9 = {0x35,0x11,0x11,0x11,0x11,0x11,0x11,(byte)0x99,0x55,0x31,0x33,0x34,0x37,0x34,0x33,0x2e,0x30,0x30,0x33,0x2c,0x41,0x2c,0x30,0x36,0x34,0x38,0x2e,0x39,0x38,0x36,0x36,0x2c,0x53,0x2c,0x31,0x30,0x37,0x30,0x37,0x2e,0x35,0x37,0x39,0x35,0x2c,0x45,0x2c,0x30,0x30,0x30,0x2e,0x30,0x2c,0x30,0x30,0x30,0x2e,0x30,0x2c,0x32,0x36,0x30,0x33,0x31,0x33,(byte)0xf3,0x15,0x0d,0x0a}; - assertNotNull(decoder.decode(null, null, factory.getBuffer(buf9, 0, buf9.length))); + verify(decoder.decode(null, null, factory.getBuffer(buf9, 0, buf9.length))); byte[] buf10 = {0x00,(byte)0x91,(byte)0x80,0x03,0x69,0x76,0x41,(byte)0x99,0x55,0x30,0x38,0x35,0x31,0x33,0x30,0x2e,0x30,0x30,0x30,0x2c,0x41,0x2c,0x33,0x30,0x35,0x33,0x2e,0x31,0x36,0x34,0x35,0x2c,0x4e,0x2c,0x30,0x37,0x35,0x35,0x35,0x2e,0x37,0x34,0x37,0x36,0x2c,0x45,0x2c,0x30,0x2e,0x30,0x30,0x2c,0x32,0x37,0x2c,0x31,0x36,0x30,0x34,0x31,0x33,0x2c,0x2c,0x2a,0x33,0x46,0x7c,0x30,0x2e,0x38,0x7c,0x32,0x34,0x35,0x7c,0x32,0x30,0x30,0x30,0x7c,0x30,0x33,0x46,0x37,0x2c,0x30,0x30,0x30,0x30,0x2c,0x30,0x30,0x30,0x30,0x2c,0x30,0x30,0x31,0x42,0x2c,0x30,0x30,0x30,0x30,0x2c,0x30,0x30,0x30,0x30,0x2c,0x30,0x30,0x30,0x30,0x2c,0x30,0x30,0x30,0x30,0x7c,0x30,0x31,0x39,0x34,0x30,0x30,0x30,0x32,0x30,0x31,0x43,0x43,0x36,0x32,0x37,0x43,0x7c,0x31,0x41,0x7c,0x30,0x31,0x31,0x36,0x30,0x38,0x34,0x39,(byte)0xe6,(byte)0xa7,0x0d,0x0a}; - assertNotNull(decoder.decode(null, null, factory.getBuffer(buf10, 0, buf10.length))); + verify(decoder.decode(null, null, factory.getBuffer(buf10, 0, buf10.length))); byte[] buf11 = {0x26,0x01,0x61,0x00,(byte)0x90,0x1f,(byte)0xff,(byte)0x99,0x55,0x31,0x36,0x35,0x38,0x35,0x33,0x2c,0x41,0x2c,0x34,0x31,0x30,0x39,0x2e,0x36,0x30,0x32,0x31,0x32,0x2c,0x4e,0x2c,0x38,0x33,0x38,0x2e,0x35,0x39,0x31,0x31,0x39,0x2c,0x57,0x2c,0x33,0x2e,0x38,0x38,0x33,0x2c,0x31,0x32,0x2e,0x30,0x30,0x2c,0x30,0x34,0x30,0x37,0x31,0x33,0x2c,0x2c,0x2a,0x34,0x46,0x7c,0x32,0x2e,0x35,0x7c,0x31,0x31,0x30,0x7c,0x00,0x06,0x00,0x00,0x7c,0x00,0x00,0x01,0x0f,0x7c,0x30,0x32,0x42,0x30,0x2c,0x30,0x42,0x33,0x36,(byte)0x97,0x74,0x0d,0x0a}; - assertNotNull(decoder.decode(null, null, factory.getBuffer(buf11, 0, buf11.length))); + verify(decoder.decode(null, null, factory.getBuffer(buf11, 0, buf11.length))); int[] buf12 = {0x67,0x62,0x20,0x10,0x05,0x35,0x62,0xaa,0x00,0x00,0x01,0x00,0x01,0xae,0x4f,0x00,0x00,0x00,0x07,0x80,0x00,0x00,0x00,0x30,0x39,0x35,0x31,0x35,0x36,0x2e,0x30,0x30,0x30,0x2c,0x41,0x2c,0x32,0x36,0x32,0x33,0x2e,0x38,0x39,0x36,0x36,0x2c,0x4e,0x2c,0x30,0x35,0x30,0x30,0x35,0x2e,0x30,0x36,0x38,0x30,0x2c,0x45,0x2c,0x32,0x34,0x2e,0x35,0x2c,0x32,0x34,0x31,0x2e,0x30,0x2c,0x32,0x32,0x31,0x30,0x31,0x33,0x59,0x9c,0x0d,0x0a}; assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray(buf12)))); diff --git a/test/org/traccar/protocol/MeitrackProtocolDecoderTest.java b/test/org/traccar/protocol/MeitrackProtocolDecoderTest.java index 8df5434b2..6d72ca2da 100644 --- a/test/org/traccar/protocol/MeitrackProtocolDecoderTest.java +++ b/test/org/traccar/protocol/MeitrackProtocolDecoderTest.java @@ -1,6 +1,7 @@ package org.traccar.protocol; -import static org.junit.Assert.assertNotNull; +import org.traccar.helper.TestDataManager; +import static org.traccar.helper.DecoderVerifier.verify; import org.junit.Test; public class MeitrackProtocolDecoderTest { @@ -11,28 +12,28 @@ public class MeitrackProtocolDecoderTest { MeitrackProtocolDecoder decoder = new MeitrackProtocolDecoder(null); decoder.setDataManager(new TestDataManager()); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "$$X138,862170010187175,AAA,35,-29.960365,-51.655455,130507201625,A,8,9,0,107,0.9,7,169322,126582,724|6|0547|132B,0000,0009|000A||0278|0000,*BE")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "$$]138,012896000475498,AAA,35,-6.138255,106.910545,121205074600,A,5,18,0,0,0,49,3800,24826,510|10|0081|4F4F,0000,0011|0012|0010|0963|0000,,*94")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "$$d138,012896000475498,AAA,35,-6.138255,106.910545,121205074819,A,7,18,0,0,0,49,3800,24965,510|10|0081|4F4F,0000,000D|0010|0012|0963|0000,,*BF")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "$$j138,012896000475498,AAA,35,-6.138306,106.910655,121205103708,A,3,11,0,0,1,36,4182,35025,510|10|0081|4F4F,0000,000A|000C|000A|0915|0000,,*BF")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "$$m139,012896005334567,AAA,35,-33.866423,151.190060,121208020649,A,7,27,0,32,4,13,6150,49517,505|2|0B67|5A6C,0000,0000|0000|0000|0977|0000,,*F1")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "$$A141,012896005334567,AAA,35,-33.866543,151.190148,121209081758,A,6,27,0,16,1,48,65551,152784,505|2|0B5F|D9D3,0000,0000|0000|0000|0A39|0000,,*5B")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "$$_128,861074020109479,AAA,34,22.512618,114.057065,090215000318,V,0,31,0,0,0,0,0,733,302|720|3EE4|BBB5,0000,0006|0006||028C|0000,*E3")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "$$K146,013227004985762,AAA,35,28.618005,-81.246783,131101213828,A,9,22,0,209,1.1,23,80974,1187923,310|260|2A13|634E,0000,0000|0000|0000|09DA|0B34,,*51")); } diff --git a/test/org/traccar/protocol/NavigilProtocolDecoderTest.java b/test/org/traccar/protocol/NavigilProtocolDecoderTest.java index 289018951..febfb5346 100644 --- a/test/org/traccar/protocol/NavigilProtocolDecoderTest.java +++ b/test/org/traccar/protocol/NavigilProtocolDecoderTest.java @@ -1,8 +1,9 @@ package org.traccar.protocol; +import org.traccar.helper.TestDataManager; import java.nio.ByteOrder; import org.jboss.netty.buffer.ChannelBuffers; -import static org.junit.Assert.assertNotNull; +import static org.traccar.helper.DecoderVerifier.verify; import static org.junit.Assert.assertNull; import org.junit.Test; @@ -18,7 +19,7 @@ public class NavigilProtocolDecoderTest { assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, buf1))); byte[] buf2 = {0x01,0x00,(byte)0xb3,0x00,0x0f,0x00,0x24,0x00,0x00,0x00,(byte)0xf4,(byte)0xa8,0x03,0x08,0x02,0x00,(byte)0xca,0x0c,0x11,0x51,(byte)0xef,(byte)0x88,(byte)0x85,(byte)0xf0,(byte)0xb8,0x2e,0x6d,0x13,0x04,0x00,(byte)0xc0,0x04,0x03,0x00,0x00,0x00}; - assertNotNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, buf2))); + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, buf2))); } diff --git a/test/org/traccar/protocol/NavisProtocolDecoderTest.java b/test/org/traccar/protocol/NavisProtocolDecoderTest.java index 2d568765a..2b292d775 100644 --- a/test/org/traccar/protocol/NavisProtocolDecoderTest.java +++ b/test/org/traccar/protocol/NavisProtocolDecoderTest.java @@ -1,8 +1,9 @@ package org.traccar.protocol; +import org.traccar.helper.TestDataManager; import java.nio.ByteOrder; import org.jboss.netty.buffer.ChannelBuffers; -import static org.junit.Assert.assertNotNull; +import static org.traccar.helper.DecoderVerifier.verify; import static org.junit.Assert.assertNull; import org.junit.Test; @@ -18,7 +19,7 @@ public class NavisProtocolDecoderTest { assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, buf1))); byte[] buf2 = {0x40,0x4E,0x54,0x43,0x01,0x00,0x00,0x00,0x7B,0x00,0x00,0x00,0x5A,0x00,0x50,0x69,0x2A,0x3E,0x41,0x01,0x25,(byte)0xDB,0x0E,0x00,0x00,0x00,0x15,0x11,0x07,0x07,0x11,0x0A,0x0C,0x08,(byte)0x80,0x63,0x00,0x00,(byte)0xAA,0x39,(byte)0xA2,0x38,0x16,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x11,0x07,0x08,0x11,0x0A,0x0C,(byte)0xB3,(byte)0x89,(byte)0x79,0x3F,0x1A,(byte)0xEF,0x26,0x3F,0x00,0x00,0x00,0x00,0x12,0x00,0x34,(byte)0xF5,0x16,0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xFA,(byte)0xFF,0x00,0x00,0x00,(byte)0xFA,(byte)0xFF,0x00,0x00,0x00,(byte)0xFA,(byte)0xFF,(byte)0x80,(byte)0x80,(byte)0x80,(byte)0x80}; - assertNotNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, buf2))); + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, buf2))); byte[] buf3 = {0x40,0x4E,0x54,0x43,0x01,0x00,0x00,0x00,0x7B,0x00,0x00,0x00,0x13,0x00,0x47,0x37,0x2A,0x3E,0x53,0x3A,0x38,0x36,0x31,0x37,0x38,0x35,0x30,0x30,0x35,0x31,0x32,0x36,0x30,0x36,0x39}; assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, buf3))); diff --git a/test/org/traccar/protocol/NoranProtocolDecoderTest.java b/test/org/traccar/protocol/NoranProtocolDecoderTest.java index 74c6c9817..d8f228cac 100644 --- a/test/org/traccar/protocol/NoranProtocolDecoderTest.java +++ b/test/org/traccar/protocol/NoranProtocolDecoderTest.java @@ -1,7 +1,8 @@ package org.traccar.protocol; +import org.traccar.helper.TestDataManager; import org.jboss.netty.buffer.ChannelBuffers; -import static org.junit.Assert.assertNotNull; +import static org.traccar.helper.DecoderVerifier.verify; import org.junit.Test; import org.traccar.helper.ChannelBufferTools; @@ -14,7 +15,7 @@ public class NoranProtocolDecoderTest { decoder.setDataManager(new TestDataManager()); //int[] buf1 = {0x00}; - //assertNotNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray(buf1)))); + //verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray(buf1)))); } diff --git a/test/org/traccar/protocol/OsmAndProtocolDecoderTest.java b/test/org/traccar/protocol/OsmAndProtocolDecoderTest.java index 2a5b1baf0..72a19a55e 100644 --- a/test/org/traccar/protocol/OsmAndProtocolDecoderTest.java +++ b/test/org/traccar/protocol/OsmAndProtocolDecoderTest.java @@ -1,9 +1,10 @@ package org.traccar.protocol; +import org.traccar.helper.TestDataManager; import org.jboss.netty.handler.codec.http.DefaultHttpRequest; import org.jboss.netty.handler.codec.http.HttpMethod; import org.jboss.netty.handler.codec.http.HttpVersion; -import static org.junit.Assert.assertNotNull; +import static org.traccar.helper.DecoderVerifier.verify; import org.junit.Test; public class OsmAndProtocolDecoderTest { @@ -14,13 +15,13 @@ public class OsmAndProtocolDecoderTest { OsmAndProtocolDecoder decoder = new OsmAndProtocolDecoder(null); decoder.setDataManager(new TestDataManager()); - assertNotNull(decoder.decode(null, null, new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, + verify(decoder.decode(null, null, new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, "/?id=123456×tamp=1377177267&lat=60.0&lon=30.0&speed=0.0&bearing=0.0&altitude=0&hdop=0.0"))); - assertNotNull(decoder.decode(null, null, new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, + verify(decoder.decode(null, null, new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, "/?id=123456×tamp=1377177267&lat=60.0&lon=30.0"))); - assertNotNull(decoder.decode(null, null, new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, + verify(decoder.decode(null, null, new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, "/?lat=60.0&lon=30.0&speed=0.0&heading=0.0&vacc=0&hacc=0&altitude=0&deviceid=123456"))); } diff --git a/test/org/traccar/protocol/Pt3000ProtocolDecoderTest.java b/test/org/traccar/protocol/Pt3000ProtocolDecoderTest.java index 503f9ac36..f06d2312b 100644 --- a/test/org/traccar/protocol/Pt3000ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/Pt3000ProtocolDecoderTest.java @@ -1,6 +1,7 @@ package org.traccar.protocol; -import static org.junit.Assert.assertNotNull; +import org.traccar.helper.TestDataManager; +import static org.traccar.helper.DecoderVerifier.verify; import org.junit.Test; public class Pt3000ProtocolDecoderTest { @@ -11,10 +12,10 @@ public class Pt3000ProtocolDecoderTest { Pt3000ProtocolDecoder decoder = new Pt3000ProtocolDecoder(null); decoder.setDataManager(new TestDataManager()); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "%356939010012099,$GPRMC,124945.752,A,4436.6245,N,01054.4634,E,0.11,358.52,060408,,,A,+393334347445,N028d")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "%356939010014433,$GPRMC,172821.000,A,4019.5147,N,00919.1160,E,0.00,,010613,,,A,+393998525043,N098d")); } diff --git a/test/org/traccar/protocol/Pt502ProtocolDecoderTest.java b/test/org/traccar/protocol/Pt502ProtocolDecoderTest.java index 8fdbd4caf..8ca902a2c 100644 --- a/test/org/traccar/protocol/Pt502ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/Pt502ProtocolDecoderTest.java @@ -1,6 +1,7 @@ package org.traccar.protocol; -import static org.junit.Assert.assertNotNull; +import org.traccar.helper.TestDataManager; +import static org.traccar.helper.DecoderVerifier.verify; import org.junit.Test; public class Pt502ProtocolDecoderTest { @@ -11,22 +12,22 @@ public class Pt502ProtocolDecoderTest { Pt502ProtocolDecoder decoder = new Pt502ProtocolDecoder(null); decoder.setDataManager(new TestDataManager()); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "$POS,6094,205523.000,A,1013.6223,N,06728.4248,W,0.0,99.3,011112,,,A/00000,00000/0/23895000//")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "$POS,6120,233326.000,V,0935.1201,N,06914.6933,W,0.00,,151112,,,A/00000,00000/0/0/")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "$POS,6002,233257.000,A,0931.0430,N,06912.8707,W,0.05,146.98,141112,,,A/00010,00000/0/5360872")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "$POS,6095,233344.000,V,0933.0451,N,06912.3360,W,,,151112,,,N/00000,00000/0/1677600/")); - /*assertNotNull(decoder.decode(null, null, + /*verify(decoder.decode(null, null, "$PHO0,6091,233606.000,A,0902.9855,N,06944.3654,W,0.0,43.8,141112,,,A/00010,00000/0/224000//"));*/ - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "$POS,353451000164,082405.000,A,1254.8501,N,10051.6752,E,0.00,237.99,160513,,,A/0000,0/0/55000//a71/")); diff --git a/test/org/traccar/protocol/RuptelaProtocolDecoderTest.java b/test/org/traccar/protocol/RuptelaProtocolDecoderTest.java index 165f417b4..bb793d6a0 100644 --- a/test/org/traccar/protocol/RuptelaProtocolDecoderTest.java +++ b/test/org/traccar/protocol/RuptelaProtocolDecoderTest.java @@ -1,7 +1,8 @@ package org.traccar.protocol; +import org.traccar.helper.TestDataManager; import org.jboss.netty.buffer.ChannelBuffers; -import static org.junit.Assert.assertNotNull; +import static org.traccar.helper.DecoderVerifier.verify; import static org.junit.Assert.assertNull; import org.junit.Test; @@ -14,22 +15,22 @@ public class RuptelaProtocolDecoderTest { decoder.setDataManager(new TestDataManager()); byte[] buf1 = {0x00,0x79,0x00,0x00,0x0b,0x1a,0x2a,0x55,(byte)0x85,(byte)0xc3,0x01,0x00,0x02,0x4e,(byte)0x9c,0x03,0x69,0x00,0x00,0x0f,0x10,0x17,0x33,0x20,(byte)0x8f,(byte)0xf4,0x5e,0x07,(byte)0xb3,0x1b,0x57,0x0a,0x00,0x10,0x09,0x09,0x06,0x05,0x01,0x1b,0x1a,0x02,0x00,0x03,0x00,0x1c,0x01,(byte)0xad,0x01,0x02,0x1d,0x33,(byte)0x8e,0x16,0x00,0x00,0x02,(byte)0x96,0x00,0x00,0x60,0x1a,0x41,0x01,0x4b,(byte)0xc1,0x6d,0x00,0x4e,(byte)0x9c,0x03,(byte)0x84,0x00,0x00,0x0f,0x10,0x4f,(byte)0xdf,0x20,(byte)0x90,0x0d,0x20,0x07,0x51,0x03,(byte)0xb0,0x0a,0x00,0x13 ,0x08,0x09,0x06,0x05,0x01,0x1b,0x1a,0x02,0x00,0x03,0x00,0x1c,0x01,(byte)0xad,0x01,0x02,0x1d,0x33,(byte)0xb1,0x16,0x00,0x00,0x02,(byte)0x96,0x00,0x00,0x60,0x1a,0x41,0x01,0x4b,(byte)0xc1,(byte)0xea,0x00,0x28,(byte)0xf9}; - assertNotNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(buf1))); + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(buf1))); /*byte[] buf2 = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xA7,0x08,0x04,0x00,0x00,0x01,0x13,(byte)0xfc,0x20,(byte)0x8d,(byte)0xff,0x00,0x0f,0x14,(byte)0xf6,0x50,0x20,(byte)0x9c,(byte)0xca,(byte)0x80,0x00,0x6f,0x00,(byte)0xd6,0x04,0x00,0x04,0x00,0x04,0x03,0x01,0x01,0x15,0x03,0x16,0x03,0x00,0x01,0x46,0x00,0x00,0x01,0x5d,0x00,0x00,0x00,0x01,0x13,(byte)0xfc,0x17,0x61,0x0b,0x00,0x0f,0x14,(byte)0xff,(byte)0xe0,0x20,(byte)0x9c,(byte)0xc5,(byte)0x80,0x00,0x6e,0x00,(byte)0xc0,0x05,0x00,0x01,0x00,0x04,0x03,0x01,0x01,0x15,0x03,0x16,0x01,0x00,0x01,0x46,0x00,0x00,0x01,0x5e,0x00,0x00,0x00,0x01,0x13,(byte)0xfc,0x28,0x49,0x45,0x00,0x0f,0x15,0x0f,0x00,0x20,(byte)0x9c,(byte)0xd2,0x00,0x00,(byte)0x95,0x01,0x08,0x04,0x00,0x00,0x00,0x04,0x03,0x01,0x01,0x15,0x00,0x16,0x03,0x00,0x01,0x46,0x00,0x00,0x01,0x5d,0x00,0x00,0x00,0x01,0x13,(byte)0xfc,0x26,0x7c,0x5b,0x00,0x0f,0x15,0x0a,0x50,0x20,(byte)0x9c,(byte)0xcc,(byte)0xc0,0x00,(byte)0x93,0x00,0x68,0x04,0x00,0x00,0x00,0x04,0x03,0x01,0x01,0x15,0x00,0x16,0x03,0x00,0x01,0x46,0x00,0x00,0x01,0x5b,0x00,0x04,0x00,0x00}; - assertNotNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(buf2))); + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(buf2))); byte[] buf3 = {0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x47,0x08,0x06,0x00,0x00,0x01,0x3e,0x5a,0x60,(byte)0xa4,(byte)0xcb,0x00,0x3f,(byte)0xa7,(byte)0xb7,(byte)0x80,(byte)0xfc,0x42,0x45,0x18,0x00,0x42,0x00,0x00,0x0a,0x00,0x00,0x00,0x09,0x05,0x01,0x01,0x02,0x00,(byte)0xb3,0x00,(byte)0xb4,0x00,(byte)0xf0,0x00,0x03,0x42,0x68,(byte)0xa7,0x46,0x01,0x18,0x18,0x00,0x00,0x01,(byte)0xc7,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x3e,0x5d,(byte)0xc8,(byte)0xba,0x28,0x00,0x3f,(byte)0xa7,(byte)0xc0,(byte)0x80,(byte)0xfc,0x42,0x46,0x04,0x00,0x01,0x00,0x00,0x05,0x00,0x00,0x00,0x09,0x05,0x01,0x01,0x02,0x00,(byte)0xb3,0x00,(byte)0xb4,0x00,(byte)0xf0,0x01,0x03,0x42,0x68,(byte)0xb4,0x46,0x00,(byte)0xef,0x18,0x00,0x00,0x01,(byte)0xc7,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x3e,0x5d,(byte)0xc9,0x04,0x55,0x00,0x3f,(byte)0xa7,(byte)0xb6,0x40,(byte)0xfc,0x42,0x43,(byte)0x88,0x00,0x3a,0x00,0x00,0x07,0x00,0x00,(byte)0xf0,0x09,0x05,0x01,0x01,0x02,0x00,(byte)0xb3,0x00,(byte)0xb4,0x00,(byte)0xf0,0x00,0x03,0x42,0x68,(byte)0xdc,0x46,0x00,(byte)0xf7,0x18,0x00,0x00,0x01,(byte)0xc7,0x00,0x00,0x00,0x1d,0x00,0x00,0x00,0x01,0x3e,0x5d,(byte)0xc9,(byte)0xd3,0x68,0x00,0x3f,(byte)0xa7,(byte)0xb8,0x00,(byte)0xfc,0x42,0x44,0x30,0x00,0x49,0x00,0x00,0x04,0x00,0x00,0x00,0x09,0x05,0x01,0x01,0x02,0x00,(byte)0xb3,0x00,(byte)0xb4,0x00,(byte)0xf0,0x01,0x03,0x42,0x67,(byte)0xde,0x46,0x01,0x07,0x18,0x00,0x00,0x01,(byte)0xc7,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x3e,0x5d,(byte)0xca,0x31,0x1d,0x00,0x3f,(byte)0xa7,(byte)0xb6,(byte)0x80,(byte)0xfc,0x42,0x43,(byte)0xcc,0x00,0x42,0x00,0x00,0x07,0x00,0x00,(byte)0xf0,0x09,0x05,0x01,0x01,0x02,0x00,(byte)0xb3,0x00,(byte)0xb4,0x00,(byte)0xf0,0x00,0x03,0x42,0x68,0x53,0x46,0x01,0x0b,0x18,0x00,0x00,0x01,(byte)0xc7,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x3e,0x5d,(byte)0xcf,(byte)0xaf,(byte)0xe9,0x00,0x3f,(byte)0xa7,(byte)0xb6,0x00,(byte)0xfc,0x42,0x42,(byte)0xf0,0x00,0x3d,0x00,0x00,0x08,0x00,0x00,0x00,0x09,0x05,0x01,0x01,0x02,0x00,(byte)0xb3,0x00,(byte)0xb4,0x00,(byte)0xf0,0x00,0x03,0x42,0x68,0x52,0x46,0x01,0x19,0x18,0x00,0x00,0x01,(byte)0xc7,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x02,0x75}; - assertNotNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(buf3))); + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(buf3))); byte[] buf4 = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x2c,0x08,0x01,0x00,0x00,0x01,0x3e,(byte)0xff,(byte)0x8d,0x6f,(byte)0x98,0x00,0x17,0x32,(byte)0x95,0x00,0x21,0x11,(byte)0xf4,0x00,0x00,(byte)0x81,0x00,(byte)0xae,0x0b,0x00,0x00,0x00,0x04,0x01,0x01,0x00,0x03,0x09,0x00,0x16,0x43,0x29,(byte)0x80,0x42,0x2f,0x72,0x00,0x00,0x01,0x00,0x00,0x7a,0x5d}; - assertNotNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(buf4))); + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(buf4))); byte[] buf5 = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xc7,0x07,0x04,0x41,(byte)0xbf,(byte)0x9d,(byte)0xb0,0x0f,(byte)0xff,0x42,0x5a,(byte)0xdb,(byte)0xd7,0x41,(byte)0xca,0x6e,0x1e,0x00,(byte)0x9e,0x12,0x05,0x07,0x00,0x01,0x03,0x0b,0x16,0x00,0x00,0x60,0x1a,0x02,0x01,0x5e,0x02,0x00,0x03,0x14,0x00,0x66,0x15,0x00,0x0a,0x16,0x00,0x67,0x01,0x05,0x00,0x00,0x0c,(byte)0xe4,0x41,(byte)0xbf,(byte)0x9d,(byte)0x92,0x0f,(byte)0xff,0x42,0x5a,(byte)0xdb,(byte)0xb1,0x41,(byte)0xca,0x6f,(byte)0xc9,0x00,(byte)0xa2,(byte)0xb2,0x18,0x07,0x00,0x01,0x03,0x0b,0x16,0x00,0x00,0x60,0x1a,0x02,0x01,0x5e,0x02,0x00,0x03,0x14,0x00,0x66,0x15,0x00,0x0a,0x16,0x00,0x67,0x01,0x05,0x00,0x00,0x0c,(byte)0xc6,0x41,(byte)0xbf,(byte)0x9d,0x74,0x0f,(byte)0xff,0x42,0x5a,(byte)0xdb,(byte)0xee,0x41,(byte)0xca,0x73,(byte)0x92,0x00,(byte)0xb6,(byte)0xc9,0x1e,0x07,0x00,0x01,0x03,0x0b,0x1f,0x00,0x00,0x60,0x1a,0x02,0x01,0x5f,0x02,0x00,0x03,0x14,0x00,0x66,0x15,0x00,0x0a,0x16,0x00,0x66,0x01,0x05,0x00,0x00,0x0c,(byte)0xa8,0x41,(byte)0xbf,(byte)0x9c,(byte)0xfc,0x0f,(byte)0xff,0x42,0x5a,(byte)0xdb,(byte)0xa0,0x41,(byte)0xca,0x70,(byte)0xc1,0x00,(byte)0xb9,0x38,0x13,0x07,0x00,0x01,0x03,0x0b,0x1f,0x00,0x00,0x60,0x1a,0x02,0x01,0x5f,0x02,0x00,0x03,0x14,0x00,0x23,0x15,0x00,0x0a,0x16,0x00,0x25,0x01,0x05,0x00,0x00,0x0c,0x30,0x04,0x00,0x00,0x00}; - assertNotNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(buf5))); + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(buf5))); byte[] buf6 = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x31,0x07,0x02,0x4c,0x61,0x41,0x0b,0x01,0x3f,0x42,0x31,(byte)0xc2,(byte)0xc1,0x41,(byte)0xd0,(byte)0xbe,(byte)0xb9,0x00,0x3d,0x00,0x00,0x05,0x00,0x64,(byte)0x83,(byte)0xff,0x4c,0x61,0x40,(byte)0xeb,0x01,0x3f,0x42,0x31,(byte)0xc2,(byte)0xc1,0x41,(byte)0xd0,(byte)0xbe,(byte)0xb9,0x00,0x3d,0x00,0x00,0x05,0x00,0x64,(byte)0x83,(byte)0xff,0x02,0x00,0x00,0x41,(byte)0xdf}; - assertNotNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(buf6)));*/ + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(buf6)));*/ } diff --git a/test/org/traccar/protocol/SanavProtocolDecoderTest.java b/test/org/traccar/protocol/SanavProtocolDecoderTest.java index 83895245b..d6d06edaa 100644 --- a/test/org/traccar/protocol/SanavProtocolDecoderTest.java +++ b/test/org/traccar/protocol/SanavProtocolDecoderTest.java @@ -1,6 +1,7 @@ package org.traccar.protocol; -import static org.junit.Assert.assertNotNull; +import org.traccar.helper.TestDataManager; +import static org.traccar.helper.DecoderVerifier.verify; import org.junit.Test; public class SanavProtocolDecoderTest { @@ -11,22 +12,22 @@ public class SanavProtocolDecoderTest { SanavProtocolDecoder decoder = new SanavProtocolDecoder(null); decoder.setDataManager(new TestDataManager()); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "imei=352024028982787&rmc=$GPRMC,103048.000,A,4735.0399,N,01905.2895,E,0.00,0.00,171013,,*05,AUTO-4095mv")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "imei:352024028980000rmc:$GPRMC,093604.354,A,4735.0862,N,01905.2146,E,0.00,0.00,171013,,*09,AUTO-4103mv")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "imei:352024027800000rmc:$GPRMC,000025.000,A,4735.0349,N,01905.2899,E,0.00,202.97,171013,,*03,3950mV,AUTO")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "imei:352024020976845rmc:$GPRMC,000201.000,A,4655.7043,N,01941.3796,E,0.54,159.14,171013,,,A*65,AUTO")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "imei=352024028982787&rmc=$GPRMC,103048.000,A,4735.0399,N,01905.2895,E,0.00,0.00,171013,,")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "65,AUTOimei=352024028982787&rmc=$GPRMC,103048.000,A,4735.0399,N,01905.2895,E,0.00,0.00,171013,,")); } diff --git a/test/org/traccar/protocol/SkypatrolProtocolDecoderTest.java b/test/org/traccar/protocol/SkypatrolProtocolDecoderTest.java index e3b1a0dc1..d1b87ea6d 100644 --- a/test/org/traccar/protocol/SkypatrolProtocolDecoderTest.java +++ b/test/org/traccar/protocol/SkypatrolProtocolDecoderTest.java @@ -1,8 +1,9 @@ package org.traccar.protocol; +import org.traccar.helper.TestDataManager; import org.jboss.netty.buffer.ChannelBufferFactory; import org.jboss.netty.buffer.HeapChannelBufferFactory; -import static org.junit.Assert.assertNotNull; +import static org.traccar.helper.DecoderVerifier.verify; import org.junit.Test; public class SkypatrolProtocolDecoderTest { @@ -15,7 +16,7 @@ public class SkypatrolProtocolDecoderTest { ChannelBufferFactory factory = new HeapChannelBufferFactory(); byte[] buf1 = {0x00,0x05,0x02,0x10,0x04,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,0x00,0x00,0x00,0x0D,0x31,0x31,0x34,0x37,0x37,0x35,0x38,0x33,0x00,(byte)0xCB,0x00,0x00,0x00,0x00,0x0E,0x11,0x07,0x0C,0x01,0x01,(byte)0x84,(byte)0xD0,0x32,(byte)0xFB,0x38,0x41,0x37,0x00,0x00,0x00,0x00,0x16,0x07,0x2B,0x00,0x00,0x17,0x05,0x00,0x32,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x4E,0x0C,0x07,0x11,0x16,0x07,0x2C,0x10,0x59,0x00,0x05,0x00,0x00,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x00,0x03,0x10,0x02,0x60,(byte)0xB7,0x36,0x3B,0x63,0x06,(byte)0xC1,0x1A,0x00,(byte)0xB7,0x36,0x37,(byte)0xF2,0x06,(byte)0xBF,0x19,(byte)0xB7,0x36,0x37,(byte)0xF1,0x06,(byte)0xB5,0x0E,(byte)0xB7,0x36,0x38,(byte)0xB1,0x06,(byte)0xBB,0x0B,(byte)0xB7,0x36,0x3B,0x61,0x06,(byte)0xB8,0x0A,(byte)0xB7,0x36,0x37,(byte)0xF3,0x06,(byte)0xB7,0x09,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C}; - assertNotNull(decoder.decode(null, null, factory.getBuffer(buf1, 0, buf1.length))); + verify(decoder.decode(null, null, factory.getBuffer(buf1, 0, buf1.length))); } diff --git a/test/org/traccar/protocol/SuntechProtocolDecoderTest.java b/test/org/traccar/protocol/SuntechProtocolDecoderTest.java index a5b079fa8..fae36ec64 100644 --- a/test/org/traccar/protocol/SuntechProtocolDecoderTest.java +++ b/test/org/traccar/protocol/SuntechProtocolDecoderTest.java @@ -1,6 +1,7 @@ package org.traccar.protocol; -import static org.junit.Assert.assertNotNull; +import org.traccar.helper.TestDataManager; +import static org.traccar.helper.DecoderVerifier.verify; import static org.junit.Assert.assertNull; import org.junit.Test; @@ -14,31 +15,31 @@ public class SuntechProtocolDecoderTest { assertNull(decoder.decode(null, null, "SA200ALV;317652")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "SA200STT;317652;042;20120718;15:37:12;16d41;-15.618755;-056.083241;000.024;000.00;8;1;41548;12.17;100000;2;1979")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "SA200STT;317652;042;20120721;19:04:30;16d41;-15.618743;-056.083221;000.001;000.00;12;1;41557;12.21;000000;1;3125")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "SA200STT;317652;042;20120722;00:24:23;4f310;-15.618767;-056.083214;000.011;000.00;11;1;41557;12.21;000000;1;3205")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "SA200STT;315198;042;20120808;20:37:34;3fac25;-15.618731;-056.083216;000.007;000.00;12;1;48;0.00;000000;1;0127")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "SA200STT;315198;042;20120809;13:43:34;4f310;-15.618709;-056.083223;000.025;000.00;8;1;49;12.10;100000;2;0231")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "SA200EMG;317652;042;20120718;15:35:41;16d41;-15.618740;-056.083252;000.034;000.00;8;1;41548;12.17;110000;1")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "SA200ALT;317652;042;20120829;14:25:58;16d41;-15.618770;-056.083242;000.029;000.00;0;0;2404240;0.00;000000;10")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "SA200STT;430070;133;20130615;22:22:32;151347;+02.860514;-060.653351;000.003;000.00;12;1;0;12.39;000000;1;0208")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "ST910;Location;344506;017;20130727;14:10:00;-25.398714;-049.296818;000.187;000.00;1;4.32;1;1;0001")); } diff --git a/test/org/traccar/protocol/SyrusProtocolDecoderTest.java b/test/org/traccar/protocol/SyrusProtocolDecoderTest.java index e257b07d9..fa48ce286 100644 --- a/test/org/traccar/protocol/SyrusProtocolDecoderTest.java +++ b/test/org/traccar/protocol/SyrusProtocolDecoderTest.java @@ -1,6 +1,7 @@ package org.traccar.protocol; -import static org.junit.Assert.assertNotNull; +import org.traccar.helper.TestDataManager; +import static org.traccar.helper.DecoderVerifier.verify; import org.junit.Test; public class SyrusProtocolDecoderTest { @@ -11,16 +12,16 @@ public class SyrusProtocolDecoderTest { SyrusProtocolDecoder decoder = new SyrusProtocolDecoder(null); decoder.setDataManager(new TestDataManager()); - assertNotNull(decoder.decode(null, null, - ">RPV15714+3739438-1220384601512612;ID=1234;*7F")); + verify(decoder.decode(null, null, + ">RPV00000+3739438-1220384601512612;ID=1234;*7F")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "\r\n>REV691615354941+3570173+1397742703203212;ID=Test")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, ">REV481599462982+2578391-0802945201228512;ID=Test")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, ">REV131756153215+3359479-0075299001031332;VO=10568798;IO=310;SV=10;BL=4190;CV09=0;AD=0;AL=+47;ID=356612021059680")); } diff --git a/test/org/traccar/protocol/T55ProtocolDecoderTest.java b/test/org/traccar/protocol/T55ProtocolDecoderTest.java index 691474043..e690a7caa 100644 --- a/test/org/traccar/protocol/T55ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/T55ProtocolDecoderTest.java @@ -1,6 +1,7 @@ package org.traccar.protocol; -import static org.junit.Assert.assertNotNull; +import org.traccar.helper.TestDataManager; +import static org.traccar.helper.DecoderVerifier.verify; import static org.junit.Assert.assertNull; import org.junit.Test; @@ -16,22 +17,22 @@ public class T55ProtocolDecoderTest { assertNull(decoder.decode(null, null, "$PCPTI,CradlePoint Test,184453,184453.0,6F*57")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "$GPRMC,094907.000,A,6000.5332,N,03020.5192,E,1.17,60.26,091111,,*33")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "$GPRMC,115528.000,A,6000.5432,N,03020.4948,E,,,091111,,*06")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "$GPRMC,064411.000,A,3717.240078,N,00603.046984,W,0.000,1,010313,,,A*6C")); - assertNotNull(decoder.decode(null, null, - "$GPGGA,184453.0,4337.200755,N,11611.955704,W,1,05,3.5,825.5,M,-11.0,M,,*6F")); + verify(decoder.decode(null, null, + "$GPGGA,000000.0,4337.200755,N,11611.955704,W,1,05,3.5,825.5,M,-11.0,M,,*6F")); - assertNotNull(decoder.decode(null, null, - "$GPGGA,123519,4807.038,N,01131.000,E,1,08,0.9,545.4,M,46.9,M,,*47")); + verify(decoder.decode(null, null, + "$GPGGA,000000,4807.038,N,01131.000,E,1,08,0.9,545.4,M,46.9,M,,*47")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "$GPRMA,V,0000.00,S,00000.00,E,,,00.0,000.,11.,E*7")); } diff --git a/test/org/traccar/protocol/TeltonikaProtocolDecoderTest.java b/test/org/traccar/protocol/TeltonikaProtocolDecoderTest.java index 44bf1fd8f..2f9fd0ac2 100644 --- a/test/org/traccar/protocol/TeltonikaProtocolDecoderTest.java +++ b/test/org/traccar/protocol/TeltonikaProtocolDecoderTest.java @@ -1,7 +1,8 @@ package org.traccar.protocol; +import org.traccar.helper.TestDataManager; import org.jboss.netty.buffer.ChannelBuffers; -import static org.junit.Assert.assertNotNull; +import static org.traccar.helper.DecoderVerifier.verify; import static org.junit.Assert.assertNull; import org.junit.Test; import org.traccar.helper.ChannelBufferTools; @@ -18,22 +19,22 @@ public class TeltonikaProtocolDecoderTest { assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray(buf1)))); int[] buf2 = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xA7,0x08,0x04,0x00,0x00,0x01,0x13,0xfc,0x20,0x8d,0xff,0x00,0x0f,0x14,0xf6,0x50,0x20,0x9c,0xca,0x80,0x00,0x6f,0x00,0xd6,0x04,0x00,0x04,0x00,0x04,0x03,0x01,0x01,0x15,0x03,0x16,0x03,0x00,0x01,0x46,0x00,0x00,0x01,0x5d,0x00,0x00,0x00,0x01,0x13,0xfc,0x17,0x61,0x0b,0x00,0x0f,0x14,0xff,0xe0,0x20,0x9c,0xc5,0x80,0x00,0x6e,0x00,0xc0,0x05,0x00,0x01,0x00,0x04,0x03,0x01,0x01,0x15,0x03,0x16,0x01,0x00,0x01,0x46,0x00,0x00,0x01,0x5e,0x00,0x00,0x00,0x01,0x13,0xfc,0x28,0x49,0x45,0x00,0x0f,0x15,0x0f,0x00,0x20,0x9c,0xd2,0x00,0x00,0x95,0x01,0x08,0x04,0x00,0x00,0x00,0x04,0x03,0x01,0x01,0x15,0x00,0x16,0x03,0x00,0x01,0x46,0x00,0x00,0x01,0x5d,0x00,0x00,0x00,0x01,0x13,0xfc,0x26,0x7c,0x5b,0x00,0x0f,0x15,0x0a,0x50,0x20,0x9c,0xcc,0xc0,0x00,0x93,0x00,0x68,0x04,0x00,0x00,0x00,0x04,0x03,0x01,0x01,0x15,0x00,0x16,0x03,0x00,0x01,0x46,0x00,0x00,0x01,0x5b,0x00,0x04,0x00,0x00}; - assertNotNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray(buf2)))); + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray(buf2)))); int[] buf3 = {0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x47,0x08,0x06,0x00,0x00,0x01,0x3e,0x5a,0x60,0xa4,0xcb,0x00,0x3f,0xa7,0xb7,0x80,0xfc,0x42,0x45,0x18,0x00,0x42,0x00,0x00,0x0a,0x00,0x00,0x00,0x09,0x05,0x01,0x01,0x02,0x00,0xb3,0x00,0xb4,0x00,0xf0,0x00,0x03,0x42,0x68,0xa7,0x46,0x01,0x18,0x18,0x00,0x00,0x01,0xc7,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x3e,0x5d,0xc8,0xba,0x28,0x00,0x3f,0xa7,0xc0,0x80,0xfc,0x42,0x46,0x04,0x00,0x01,0x00,0x00,0x05,0x00,0x00,0x00,0x09,0x05,0x01,0x01,0x02,0x00,0xb3,0x00,0xb4,0x00,0xf0,0x01,0x03,0x42,0x68,0xb4,0x46,0x00,0xef,0x18,0x00,0x00,0x01,0xc7,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x3e,0x5d,0xc9,0x04,0x55,0x00,0x3f,0xa7,0xb6,0x40,0xfc,0x42,0x43,0x88,0x00,0x3a,0x00,0x00,0x07,0x00,0x00,0xf0,0x09,0x05,0x01,0x01,0x02,0x00,0xb3,0x00,0xb4,0x00,0xf0,0x00,0x03,0x42,0x68,0xdc,0x46,0x00,0xf7,0x18,0x00,0x00,0x01,0xc7,0x00,0x00,0x00,0x1d,0x00,0x00,0x00,0x01,0x3e,0x5d,0xc9,0xd3,0x68,0x00,0x3f,0xa7,0xb8,0x00,0xfc,0x42,0x44,0x30,0x00,0x49,0x00,0x00,0x04,0x00,0x00,0x00,0x09,0x05,0x01,0x01,0x02,0x00,0xb3,0x00,0xb4,0x00,0xf0,0x01,0x03,0x42,0x67,0xde,0x46,0x01,0x07,0x18,0x00,0x00,0x01,0xc7,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x3e,0x5d,0xca,0x31,0x1d,0x00,0x3f,0xa7,0xb6,0x80,0xfc,0x42,0x43,0xcc,0x00,0x42,0x00,0x00,0x07,0x00,0x00,0xf0,0x09,0x05,0x01,0x01,0x02,0x00,0xb3,0x00,0xb4,0x00,0xf0,0x00,0x03,0x42,0x68,0x53,0x46,0x01,0x0b,0x18,0x00,0x00,0x01,0xc7,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x3e,0x5d,0xcf,0xaf,0xe9,0x00,0x3f,0xa7,0xb6,0x00,0xfc,0x42,0x42,0xf0,0x00,0x3d,0x00,0x00,0x08,0x00,0x00,0x00,0x09,0x05,0x01,0x01,0x02,0x00,0xb3,0x00,0xb4,0x00,0xf0,0x00,0x03,0x42,0x68,0x52,0x46,0x01,0x19,0x18,0x00,0x00,0x01,0xc7,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x02,0x75}; - assertNotNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray(buf3)))); + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray(buf3)))); int[] buf4 = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x2c,0x08,0x01,0x00,0x00,0x01,0x3e,0xff,0x8d,0x6f,0x98,0x00,0x17,0x32,0x95,0x00,0x21,0x11,0xf4,0x00,0x00,0x81,0x00,0xae,0x0b,0x00,0x00,0x00,0x04,0x01,0x01,0x00,0x03,0x09,0x00,0x16,0x43,0x29,0x80,0x42,0x2f,0x72,0x00,0x00,0x01,0x00,0x00,0x7a,0x5d}; - assertNotNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray(buf4)))); + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray(buf4)))); int[] buf5 = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc7,0x07,0x04,0x41,0xbf,0x9d,0xb0,0x0f,0xff,0x42,0x5a,0xdb,0xd7,0x41,0xca,0x6e,0x1e,0x00,0x9e,0x12,0x05,0x07,0x00,0x01,0x03,0x0b,0x16,0x00,0x00,0x60,0x1a,0x02,0x01,0x5e,0x02,0x00,0x03,0x14,0x00,0x66,0x15,0x00,0x0a,0x16,0x00,0x67,0x01,0x05,0x00,0x00,0x0c,0xe4,0x41,0xbf,0x9d,0x92,0x0f,0xff,0x42,0x5a,0xdb,0xb1,0x41,0xca,0x6f,0xc9,0x00,0xa2,0xb2,0x18,0x07,0x00,0x01,0x03,0x0b,0x16,0x00,0x00,0x60,0x1a,0x02,0x01,0x5e,0x02,0x00,0x03,0x14,0x00,0x66,0x15,0x00,0x0a,0x16,0x00,0x67,0x01,0x05,0x00,0x00,0x0c,0xc6,0x41,0xbf,0x9d,0x74,0x0f,0xff,0x42,0x5a,0xdb,0xee,0x41,0xca,0x73,0x92,0x00,0xb6,0xc9,0x1e,0x07,0x00,0x01,0x03,0x0b,0x1f,0x00,0x00,0x60,0x1a,0x02,0x01,0x5f,0x02,0x00,0x03,0x14,0x00,0x66,0x15,0x00,0x0a,0x16,0x00,0x66,0x01,0x05,0x00,0x00,0x0c,0xa8,0x41,0xbf,0x9c,0xfc,0x0f,0xff,0x42,0x5a,0xdb,0xa0,0x41,0xca,0x70,0xc1,0x00,0xb9,0x38,0x13,0x07,0x00,0x01,0x03,0x0b,0x1f,0x00,0x00,0x60,0x1a,0x02,0x01,0x5f,0x02,0x00,0x03,0x14,0x00,0x23,0x15,0x00,0x0a,0x16,0x00,0x25,0x01,0x05,0x00,0x00,0x0c,0x30,0x04,0x00,0x00,0x00}; - assertNotNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray(buf5)))); + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray(buf5)))); int[] buf6 = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x31,0x07,0x02,0x4c,0x61,0x41,0x0b,0x01,0x3f,0x42,0x31,0xc2,0xc1,0x41,0xd0,0xbe,0xb9,0x00,0x3d,0x00,0x00,0x05,0x00,0x64,0x83,0xff,0x4c,0x61,0x40,0xeb,0x01,0x3f,0x42,0x31,0xc2,0xc1,0x41,0xd0,0xbe,0xb9,0x00,0x3d,0x00,0x00,0x05,0x00,0x64,0x83,0xff,0x02,0x00,0x00,0x41,0xdf}; - assertNotNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray(buf6)))); + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray(buf6)))); int[] buf7 = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x2b,0x08,0x01,0x00,0x00,0x01,0x40,0xd4,0xe3,0xec,0x6e,0x00,0x0c,0xc6,0x61,0xd0,0x16,0x74,0xa5,0xe0,0xff,0xfc,0x00,0x00,0x09,0x00,0x00,0x00,0x04,0x02,0x01,0x00,0xf0,0x00,0x02,0x42,0x32,0x23,0x18,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x7a,0x04}; - assertNotNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray(buf7)))); + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray(buf7)))); } diff --git a/test/org/traccar/protocol/Tk102ProtocolDecoderTest.java b/test/org/traccar/protocol/Tk102ProtocolDecoderTest.java index 11b01323c..eeb97d18f 100644 --- a/test/org/traccar/protocol/Tk102ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/Tk102ProtocolDecoderTest.java @@ -1,6 +1,7 @@ package org.traccar.protocol; -import static org.junit.Assert.assertNotNull; +import org.traccar.helper.TestDataManager; +import static org.traccar.helper.DecoderVerifier.verify; import static org.junit.Assert.assertNull; import org.junit.Test; @@ -26,13 +27,13 @@ public class Tk102ProtocolDecoderTest { assertNull(decoder.decode(null, null, "[#0000000004\u0018(062100000000000600-0-0)")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "[=00000000836(ITV013939A4913.8317N02824.9241E000.90018031310010000)")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "[=00000000366(ITV012209A4913.8281N02824.9258E000.32018031310010000)")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "[;00000000106(ONE200834A5952.8114N01046.0832E003.93212071305010000)")); } diff --git a/test/org/traccar/protocol/Tk103ProtocolDecoderTest.java b/test/org/traccar/protocol/Tk103ProtocolDecoderTest.java index 90d49b69a..91d438f58 100644 --- a/test/org/traccar/protocol/Tk103ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/Tk103ProtocolDecoderTest.java @@ -1,6 +1,7 @@ package org.traccar.protocol; -import static org.junit.Assert.assertNotNull; +import org.traccar.helper.TestDataManager; +import static org.traccar.helper.DecoderVerifier.verify; import static org.junit.Assert.assertNull; import org.junit.Test; @@ -14,25 +15,25 @@ public class Tk103ProtocolDecoderTest { assertNull(decoder.decode(null, null, "(090411121854BP0000001234567890HSO")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "(035988863964BP05000035988863964110524A4241.7977N02318.7561E000.0123536356.5100000000L000946BB")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "(013632782450BP05000013632782450120803V0000.0000N00000.0000E000.0174654000.0000000000L00000000")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "(013666666666BP05000013666666666110925A1234.5678N01234.5678W000.002033490.00000000000L000024DE")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "(013666666666BO012110925A1234.5678N01234.5678W000.0025948118.7200000000L000024DE")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "\n\n\n(088045133878BR00130228A5124.5526N00117.7152W000.0233614352.2200000000L01B0CF1C")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "(008600410203BP05000008600410203130721A4152.5790N01239.2770E000.0145238173.870100000AL0000000")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "(013012345678BR00130515A4843.9703N01907.6211E000.019232800000000000000L00009239")); } diff --git a/test/org/traccar/protocol/Tlt2hProtocolDecoderTest.java b/test/org/traccar/protocol/Tlt2hProtocolDecoderTest.java index c096c7ecf..ce9943405 100644 --- a/test/org/traccar/protocol/Tlt2hProtocolDecoderTest.java +++ b/test/org/traccar/protocol/Tlt2hProtocolDecoderTest.java @@ -1,6 +1,7 @@ package org.traccar.protocol; -import static org.junit.Assert.assertNotNull; +import org.traccar.helper.TestDataManager; +import static org.traccar.helper.DecoderVerifier.verify; import org.junit.Test; public class Tlt2hProtocolDecoderTest { @@ -11,21 +12,21 @@ public class Tlt2hProtocolDecoderTest { Tlt2hProtocolDecoder decoder = new Tlt2hProtocolDecoder(null); decoder.setDataManager(new TestDataManager()); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "#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")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "#357671030938911#V500#0000#AUTOSTOP#1\r\n" + "#00b34d3c$GPRMC,140026.000,A,2623.6452,S,02828.8990,E,0.00,65.44,130213,,,A*4B\r\n")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "#123456789000001#V3338#0000#SMS#3\r\n" + "#25ee0dff$GPRMC,083945.180,A,2233.4249,N,11406.0046,E,0.00,315.00,251207,,,A*6E\r\n" + "#25ee0dff$GPRMC,083950.180,A,2233.4249,N,11406.0046,E,0.00,315.00,251207,,,A*6E\r\n" + "#25ee0dff$GPRMC,083955.180,A,2233.4249,N,11406.0046,E,0.00,315.00,251207,,,A*6E")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "#353686009063310#353686009063310#0000#AUTO#2\r\n" + "#239757a9$GPRMC,150252.001,A,2326.6856,S,4631.8154,W,,,260513,,,A*52\r\n" + "#239757a9$GPRMC,150322.001,A,2326.6854,S,4631.8157,W,,,260513,,,A*55")); diff --git a/test/org/traccar/protocol/TopflytechProtocolDecoderTest.java b/test/org/traccar/protocol/TopflytechProtocolDecoderTest.java index 7e253c80d..03c10dda6 100644 --- a/test/org/traccar/protocol/TopflytechProtocolDecoderTest.java +++ b/test/org/traccar/protocol/TopflytechProtocolDecoderTest.java @@ -1,6 +1,7 @@ package org.traccar.protocol; -import static org.junit.Assert.assertNotNull; +import org.traccar.helper.TestDataManager; +import static org.traccar.helper.DecoderVerifier.verify; import static org.junit.Assert.assertNull; import org.junit.Test; @@ -12,7 +13,7 @@ public class TopflytechProtocolDecoderTest { TopflytechProtocolDecoder decoder = new TopflytechProtocolDecoder(null); decoder.setDataManager(new TestDataManager()); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "(880316890094910BP00XG00b600000000L00074b54S00000000R0C0F0014000100f0130531152205A0706.1395S11024.0965E000.0251.25")); } diff --git a/test/org/traccar/protocol/TotemProtocolDecoderTest.java b/test/org/traccar/protocol/TotemProtocolDecoderTest.java index 7317af419..fc78f3915 100644 --- a/test/org/traccar/protocol/TotemProtocolDecoderTest.java +++ b/test/org/traccar/protocol/TotemProtocolDecoderTest.java @@ -1,6 +1,7 @@ package org.traccar.protocol; -import static org.junit.Assert.assertNotNull; +import org.traccar.helper.TestDataManager; +import static org.traccar.helper.DecoderVerifier.verify; import static org.junit.Assert.assertNull; import org.junit.Test; @@ -15,19 +16,19 @@ public class TotemProtocolDecoderTest { assertNull(decoder.decode(null, null, "$$BB862170017856731|AA$GPRMC,000000.00,V,0000.0000,N,00000.0000,E,000.0,000.0,000000,,,A*73|00.0|00.0|00.0|000000001000|20000000000000|13790000|00000000|00000000|00000000|0.0000|0007|8C23")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "$$B8862170017856731|AA$GPRMC,171849.00,A,3644.9893,N,01012.9927,E,0.049,51,200813,,,A*73|1.59|0.97|1.25|100000001000|20130820171849|13690000|00000000|019BD508|00000000|0.0000|0026|1B2C")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "$$B2359772032984289|AA$GPRMC,104446.000,A,5011.3944,N,01439.6637,E,0.00,,290212,,,A*7D|01.8|00.9|01.5|000000100000|20120229104446|14151221|00050000|046D085E|0000|0.0000|1170|29A7")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "$$8B862170017861566|AA180613080657|A|2237.1901|N|11402.1369|E|1.579|178|8.70|100000001000|13811|00000000|253162F5|00000000|0.0000|0014|2B16")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "$$72862170017856731|3913090911165280000370000000000000000019BD508A0400000003.400000093644.9817N01012.9944E00506F2E")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "$$B0456123|61$GPRMC,114725.00,A,1258.68276,N,07730.60237,E,0.410,,080113,,,A*79|1.44|0.66|1.27|000000000000|20130108114425|03600000|00000000|053C2BFE|0000|0.3325|0063|2005")); assertNull(decoder.decode(null, null, @@ -39,22 +40,22 @@ public class TotemProtocolDecoderTest { assertNull(decoder.decode(null, null, "$$AE359772033395899|AA00000000000000000000000000000000000000000000000000000000000|00.0|00.0|00.0|00000000000|20090215001337|14182013|00000000|0012D888|0000|0.0000|0017|346E")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "$$B3359772032399074|60$GPRMC,094859.000,A,3648.2229,N,01008.0976,E,0.00,,221211,,,A*79|02.3|01.3|02.0|000000000000|20111222094858|13360808|00000000|00000000|0000|0.0000|0001||A977")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "$$B3359772032399074|09$GPRMC,094905.000,A,3648.2229,N,01008.0976,E,0.00,,221211,,,A*71|02.1|01.3|01.7|000000000000|20111222094905|03210533|00000000|00000000|0000|0.0000|0002||FA58")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "$$B3359772032399074|AA$GPRMC,093911.000,A,3648.2146,N,01008.0977,E,0.00,,140312,,,A*7E|02.1|01.1|01.8|000000000000|20120314093910|04100057|00000000|0012D887|0000|0.0000|1128||C50E")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "$$B3359772032399074|AA$GPRMC,094258.000,A,3648.2146,N,01008.0977,E,0.00,,140312,,,A*7F|02.1|01.1|01.8|000000000000|20120314094257|04120057|00000000|0012D887|0000|0.0000|1136||CA32")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "$$B3359772032399074|AA$GPRMC,234603.000,A,3648.2179,N,01008.0962,E,0.00,,030412,,,A*74|01.8|01.0|01.5|000000000000|20120403234603|14251914|00000000|0012D888|0000|0.0000|3674||940B")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "$$B3359772032399074|AA$GPRMC,234603.000,A,3648.2179,N,01008.0962,E,0.00,,030412,,,A*74|01.8|01.0|01.5|000000000000|20120403234603|14251914|00000000|0012D888|0000|0.0000|3674|940B")); } diff --git a/test/org/traccar/protocol/Tr20ProtocolDecoderTest.java b/test/org/traccar/protocol/Tr20ProtocolDecoderTest.java index ecb814708..b78f95fac 100644 --- a/test/org/traccar/protocol/Tr20ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/Tr20ProtocolDecoderTest.java @@ -1,6 +1,7 @@ package org.traccar.protocol; -import static org.junit.Assert.assertNotNull; +import org.traccar.helper.TestDataManager; +import static org.traccar.helper.DecoderVerifier.verify; import static org.junit.Assert.assertNull; import org.junit.Test; @@ -14,7 +15,7 @@ public class Tr20ProtocolDecoderTest { assertNull(decoder.decode(null, null, "%%TRACKPRO01,1")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "%%TR-10,A,050916070549,N2240.8887E11359.2994,0,000,NA,D3800000,150,CFG:resend|")); } diff --git a/test/org/traccar/protocol/V680ProtocolDecoderTest.java b/test/org/traccar/protocol/V680ProtocolDecoderTest.java index 5b1361e21..90cb3823b 100644 --- a/test/org/traccar/protocol/V680ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/V680ProtocolDecoderTest.java @@ -1,6 +1,7 @@ package org.traccar.protocol; -import static org.junit.Assert.assertNotNull; +import org.traccar.helper.TestDataManager; +import static org.traccar.helper.DecoderVerifier.verify; import static org.junit.Assert.assertNull; import org.junit.Test; @@ -15,47 +16,47 @@ public class V680ProtocolDecoderTest { assertNull(decoder.decode(null, null, "#353588102019155")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "#356823031193431##0#0000#SF#1#72403#V#04702.3025,W,2252.18380,S,008.18,0#090413#134938")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "#356823033219838#1000#0#1478#AUT#1#66830FFB#03855.6628,E,4716.6821,N,001.41,259#130812#143905")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "#353588102019155##1#0000#AUT#01#7240060be7873f#4849.079800,W,2614.458200,S,0.00,0.00#130413#182110.000")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "#353588302045917##1#0000#AUT#01#7243141c2b14c3#4738.442300,W,2334.874000,S,0.00,0.30#170413#004831.000")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "#352897045085282##0#0000#AUT#1#72400510730208,00d36307,10734fc4#4647.8922,W,2339.1956,S,2.60,63.74#200413#094310.000")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "#356823033537791##0#0000#AUT#1#V#03610.2179,E,5004.5796,N,000.01,349#180513#073758")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "#356823031236214##0#0000#AUT#1#V#01904.5491,E,6941.0085,N,000.09,248#170513#160140")); - assertNotNull(decoder.decode(null, null, + assertNull(decoder.decode(null, null, "#353588550032869##1#0000#AUT#01#72400401cd01a5#00000.0000,E,0000.0000,N,0.00,#000000#000000.000")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "#352897045085282##0#0000#AUT#1#72400510730208,00d36307,10734fc4#4647.8922,W,2339.1956,S,2.60,63.74#200413#094310.000##")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "#352165050199210##13#0000#AUT#1#72400605471305,054712fd,054712ff#05144.0008,W,3005.5011,S,0.11,201.46#260713#172647.000##")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "#356823031166908#13001190527#0#0000#AUT#4#V#07136.4070,W,1040.0575,N,000.35,257#280813#142836#V#07136.4088,W,1040.0580,N,000.49,288#280813#142846#V#07136.4098,W,1040.0590,N,000.59,264#280813#142856#V#07136.4093,W,1040.0605,N,000.30,264#280813#142906##")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "#135790246811222#13486119277#1#0000#SOS#1#27bc10af#11407.4182,E,2232.7632,N,0.00,79.50#070709#134147.000##")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "#355488020132015##1#0000#AUT#01#510089246a34c0#10641.338800,E,619.427100,S,0.00,0.00#011113#161942.000##")); - /*assertNotNull(decoder.decode(null, null, - "#359094025419110#bigfriend#0#1234#AUTO#1##04632.8846,W,2327.2264,S,0.00,0.00#220913#234808##"));*/ + verify(decoder.decode(null, null, + "#359094025419110#bigfriend#0#1234#AUTO#1##04632.8846,W,2327.2264,S,0.00,0.00#220913#234808##")); } diff --git a/test/org/traccar/protocol/WialonProtocolDecoderTest.java b/test/org/traccar/protocol/WialonProtocolDecoderTest.java index bb6fda7b5..0b6306aca 100644 --- a/test/org/traccar/protocol/WialonProtocolDecoderTest.java +++ b/test/org/traccar/protocol/WialonProtocolDecoderTest.java @@ -1,6 +1,7 @@ package org.traccar.protocol; -import static org.junit.Assert.assertNotNull; +import org.traccar.helper.TestDataManager; +import static org.traccar.helper.DecoderVerifier.verify; import static org.junit.Assert.assertNull; import org.junit.Test; @@ -16,10 +17,10 @@ public class WialonProtocolDecoderTest { assertNull(decoder.decode(null, null, "#P#")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "#SD#270413;205601;5544.6025;N;03739.6834;E;1;2;3;4")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "#D#270413;205601;5544.6025;N;03739.6834;E;1;2;3;4;0.0;0;0;14.77,0.02,3.6;NA;count1:1:564,fuel:2:45.8,hw:3:V4.5")); } diff --git a/test/org/traccar/protocol/WondexProtocolDecoderTest.java b/test/org/traccar/protocol/WondexProtocolDecoderTest.java index b998a51a4..463627064 100644 --- a/test/org/traccar/protocol/WondexProtocolDecoderTest.java +++ b/test/org/traccar/protocol/WondexProtocolDecoderTest.java @@ -1,6 +1,7 @@ package org.traccar.protocol; -import static org.junit.Assert.assertNotNull; +import org.traccar.helper.TestDataManager; +import static org.traccar.helper.DecoderVerifier.verify; import org.junit.Test; public class WondexProtocolDecoderTest { @@ -11,16 +12,16 @@ public class WondexProtocolDecoderTest { WondexProtocolDecoder decoder = new WondexProtocolDecoder(null); decoder.setDataManager(new TestDataManager()); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "1044989601,20130323074605,0.000000,90.000000,0,000,0,0,2")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "123456789000001,20120101123200,130.000000,60.000000,0,000,0,0,0,0")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "210000001,20070313170040,121.123456,12.654321,0,233,0,9,2,0.0,0,0.00,0.00,0")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "1044989601,20130322172647,13.572583,52.401070,22,204,49,0,2")); } diff --git a/test/org/traccar/protocol/Xexun2ProtocolDecoderTest.java b/test/org/traccar/protocol/Xexun2ProtocolDecoderTest.java index 59a241ae3..089f2da76 100644 --- a/test/org/traccar/protocol/Xexun2ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/Xexun2ProtocolDecoderTest.java @@ -1,6 +1,7 @@ package org.traccar.protocol; -import static org.junit.Assert.assertNotNull; +import org.traccar.helper.TestDataManager; +import static org.traccar.helper.DecoderVerifier.verify; import org.junit.Test; public class Xexun2ProtocolDecoderTest { @@ -11,31 +12,31 @@ public class Xexun2ProtocolDecoderTest { Xexun2ProtocolDecoder decoder = new Xexun2ProtocolDecoder(null); decoder.setDataManager(new TestDataManager()); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "130302125349,+79604870506,GPRMC,085349.000,A,4503.2392,N,03858.5660,E,6.95,154.65,020313,,,A*6C,F,, imei:012207007744243,03,-1.5,F:4.15V,1,139,28048,250,01,278A,5072")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "111111120009,+436763737552,GPRMC,120009.590,A,4639.6774,N,01418.5737,E,0.00,0.00,111111,,,A*68,F,, imei:359853000144328,04,481.2,F:4.15V,0,139,2689,232,03,2725,0576")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "111111120009,+436763737552,GPRMC,120600.000,A,6000.0000,N,13000.0000,E,0.00,0.00,010112,,,A*68,F,help me!, imei:123456789012345,04,481.2,F:4.15V,0,139,2689,232,03,2725,0576")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "111111120009,+436763737552,GPRMC,120600.000,A,6000.0000,N,13000.0000,E,0.00,0.00,010112,,,A*68,F,help me!, imei:123456789012345,04,481.2,L:3.5V,0,139,2689,232,03,2725,0576")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "111111120009,436763737552,GPRMC,120600.000,A,6000.0000,N,13000.0000,E,0.00,0.00,010112,,,A*68,F,help me!, imei:123456789012345,04,481.2,L:3.5V,0,139,2689,232,03,2725,0576")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "111111120009,+1234,GPRMC,204530.4,A,6000.0000,N,13000.0000,E,0.0,,010112,0.0,E,A*68,F,imei:123456789012345,04,123.5,F:3.55V,0,139,,232,03,272CE1,0576")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "111111120009,+1234,GPRMC,204530.4,A,6000.000,N,01000.6288,E,0.0,0.00,230713,0.0,E,A*3C,F,imei:123456789012345,00,,F:3.88V,0,125,,262,01,224CE1,379B")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "111111120009,+1234,GPRMC,215840.7,A,6000.000,N,01000.6253,E,0.0,0.00,230713,0.0,E,A*34,F,imei:123456789012345,00,,F:3.9V,0,124,,262,01,224CE1,379B")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "130725134142,,GPRMC,134142.591,A,3845.6283,N,00909.8876,W,2.08,287.33,250713,,,A*71,F,, imei:013227000526784,03,-50.7,L:3.69V,0,128,65337,268,03,177A,119F")); } diff --git a/test/org/traccar/protocol/XexunProtocolDecoderTest.java b/test/org/traccar/protocol/XexunProtocolDecoderTest.java index 8a829c35b..79ea5740f 100644 --- a/test/org/traccar/protocol/XexunProtocolDecoderTest.java +++ b/test/org/traccar/protocol/XexunProtocolDecoderTest.java @@ -1,6 +1,7 @@ package org.traccar.protocol; -import static org.junit.Assert.assertNotNull; +import org.traccar.helper.TestDataManager; +import static org.traccar.helper.DecoderVerifier.verify; import org.junit.Test; public class XexunProtocolDecoderTest { @@ -11,22 +12,22 @@ public class XexunProtocolDecoderTest { XexunProtocolDecoder decoder = new XexunProtocolDecoder(null); decoder.setDataManager(new TestDataManager()); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "GPRMC,043435.000,A,811.299200,S,11339.9500,E,0.93,29.52,160313,00,0000.0,A*65,F,,imei:359585014597923,")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "GPRMC,150120.000,A,3346.4463,S,15057.3083,E,0.0,117.4,010911,,,A*76,F,imei:351525010943661,")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "GPRMC,010203.000,A,0102.0003,N,00102.0003,E,1.02,1.02,010203,,,A*00,F,,imei:10000000000000,")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "GPRMC,233842.000,A,5001.3060,N,01429.3243,E,0.00,,210211,,,A*74,F,imei:354776030495631,")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "GPRMC,080303.000,A,5546.7313,N,03738.6005,E,0.56,160.13,100311,,,A*6A,L,imei:354778030461167,")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "GPRMC,014623.000,A,4710.8260,N,1948.1220,E,0.11,105.40,111212,00,0000.0,A*49,F,,imei:357713002048962,")); } diff --git a/test/org/traccar/protocol/Xt7ProtocolDecoderTest.java b/test/org/traccar/protocol/Xt7ProtocolDecoderTest.java index 0f1194c73..187221e3a 100644 --- a/test/org/traccar/protocol/Xt7ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/Xt7ProtocolDecoderTest.java @@ -1,8 +1,9 @@ package org.traccar.protocol; +import org.traccar.helper.TestDataManager; import org.jboss.netty.buffer.ChannelBufferFactory; import org.jboss.netty.buffer.HeapChannelBufferFactory; -import static org.junit.Assert.assertNotNull; +import static org.traccar.helper.DecoderVerifier.verify; import org.junit.Test; public class Xt7ProtocolDecoderTest { @@ -15,7 +16,7 @@ public class Xt7ProtocolDecoderTest { ChannelBufferFactory factory = new HeapChannelBufferFactory(); byte[] buf1 = {0x53,0x54,0x58,0x32,0x30,0x31,0x30,0x31,0x30,0x31,0x38,0x30,0x31,0x20,0x20,0x20,0x20,0x20,0x20,0x02,0x6A,0x24,0x47,0x50,0x52,0x4D,0x43,0x2C,0x31,0x30,0x31,0x30,0x35,0x33,0x2E,0x30,0x30,0x30,0x2C,0x41,0x2C,0x32,0x32,0x33,0x32,0x2E,0x37,0x36,0x30,0x37,0x2C,0x4E,0x2C,0x31,0x31,0x34,0x30,0x34,0x2E,0x37,0x36,0x36,0x39,0x2C,0x45,0x2C,0x30,0x2E,0x30,0x30,0x2C,0x2C,0x32,0x33,0x31,0x31,0x31,0x30,0x2C,0x2C,0x2C,0x41,0x2A,0x37,0x46,0x2C,0x34,0x36,0x30,0x2C,0x30,0x30,0x2C,0x32,0x37,0x39,0x35,0x2C,0x30,0x45,0x36,0x41,0x2C,0x31,0x34,0x2C,0x39,0x34,0x2C,0x31,0x30,0x30,0x30,0x2C,0x30,0x30,0x30,0x30,0x2C,0x39,0x31,0x2C,0x54,0x69,0x6D,0x65,0x72,0x3B,0x31,0x44,0x0D,0x0A}; - assertNotNull(decoder.decode(null, null, factory.getBuffer(buf1, 0, buf1.length))); + verify(decoder.decode(null, null, factory.getBuffer(buf1, 0, buf1.length))); } diff --git a/test/org/traccar/protocol/YwtProtocolDecoderTest.java b/test/org/traccar/protocol/YwtProtocolDecoderTest.java index 78cd9f701..1ed6ad61c 100644 --- a/test/org/traccar/protocol/YwtProtocolDecoderTest.java +++ b/test/org/traccar/protocol/YwtProtocolDecoderTest.java @@ -1,6 +1,7 @@ package org.traccar.protocol; -import static org.junit.Assert.assertNotNull; +import org.traccar.helper.TestDataManager; +import static org.traccar.helper.DecoderVerifier.verify; import static org.junit.Assert.assertNull; import org.junit.Test; @@ -12,13 +13,13 @@ public class YwtProtocolDecoderTest { YwtProtocolDecoder decoder = new YwtProtocolDecoder(null); decoder.setDataManager(new TestDataManager()); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "%GP,3000012345:0,090723182813,E114.602345,N22.069725,,30,160,4,0,00,,2794-10FF-46000,3>0-0")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "%RP,3000012345:0,090807182815,E114.602345,N22.069725,,30,160,4,0,00")); - assertNotNull(decoder.decode(null, null, + verify(decoder.decode(null, null, "%KP,3000012345:0,090807183115,E114.602345,N22.069725,,30,160,5,0,00;")); } |