aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-10-22 15:26:17 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2015-10-22 15:26:17 +1300
commit1ca95d099df96d576a0eaddc6e42b5b41aed3e06 (patch)
tree65ae84eb5e301317263fd72c31cc54922c71eb96
parent122a26d2822f35b27b9cb0b217916d6b821d9654 (diff)
downloadtraccar-server-1ca95d099df96d576a0eaddc6e42b5b41aed3e06.tar.gz
traccar-server-1ca95d099df96d576a0eaddc6e42b5b41aed3e06.tar.bz2
traccar-server-1ca95d099df96d576a0eaddc6e42b5b41aed3e06.zip
Refactor protocol unit testing
-rw-r--r--test/org/traccar/ProtocolDecoderTest.java169
-rw-r--r--test/org/traccar/helper/DecoderVerifier.java64
-rw-r--r--test/org/traccar/helper/TestIdentityManager.java26
-rw-r--r--test/org/traccar/protocol/AdmProtocolDecoderTest.java30
-rw-r--r--test/org/traccar/protocol/ApelProtocolDecoderTest.java3
-rw-r--r--test/org/traccar/protocol/AplicomProtocolDecoderTest.java35
-rw-r--r--test/org/traccar/protocol/AquilaProtocolDecoderTest.java10
-rw-r--r--test/org/traccar/protocol/Ardi01ProtocolDecoderTest.java5
-rw-r--r--test/org/traccar/protocol/AtrackProtocolDecoderTest.java27
-rw-r--r--test/org/traccar/protocol/AutoFon45ProtocolDecoderTest.java11
-rw-r--r--test/org/traccar/protocol/AutoFonProtocolDecoderTest.java15
-rw-r--r--test/org/traccar/protocol/Avl301ProtocolDecoderTest.java15
-rw-r--r--test/org/traccar/protocol/BceProtocolDecoderTest.java26
-rw-r--r--test/org/traccar/protocol/BlackKiteProtocolDecoderTest.java11
-rw-r--r--test/org/traccar/protocol/BoxProtocolDecoderTest.java36
-rw-r--r--test/org/traccar/protocol/CalAmpProtocolDecoderTest.java31
-rw-r--r--test/org/traccar/protocol/CarTrackProtocolDecoderTest.java6
-rw-r--r--test/org/traccar/protocol/CarscopProtocolDecoderTest.java11
-rw-r--r--test/org/traccar/protocol/CastelProtocolDecoderTest.java43
-rw-r--r--test/org/traccar/protocol/CellocatorProtocolDecoderTest.java14
-rw-r--r--test/org/traccar/protocol/CityeasyProtocolDecoderTest.java23
-rw-r--r--test/org/traccar/protocol/EasyTrackProtocolDecoderTest.java20
-rw-r--r--test/org/traccar/protocol/EelinkProtocolDecoderTest.java23
-rw-r--r--test/org/traccar/protocol/EnforaProtocolDecoderTest.java23
-rw-r--r--test/org/traccar/protocol/Ev603ProtocolDecoderTest.java22
-rw-r--r--test/org/traccar/protocol/FlextrackProtocolDecoderTest.java11
-rw-r--r--test/org/traccar/protocol/FreedomProtocolDecoderTest.java5
-rw-r--r--test/org/traccar/protocol/GalileoProtocolDecoderTest.java15
-rw-r--r--test/org/traccar/protocol/GatorProtocolDecoderTest.java18
-rw-r--r--test/org/traccar/protocol/Gl100ProtocolDecoderTest.java22
-rw-r--r--test/org/traccar/protocol/Gl200ProtocolDecoderTest.java89
-rw-r--r--test/org/traccar/protocol/GlobalSatProtocolDecoderTest.java24
-rw-r--r--test/org/traccar/protocol/GoSafeProtocolDecoderTest.java13
-rw-r--r--test/org/traccar/protocol/GotopProtocolDecoderTest.java17
-rw-r--r--test/org/traccar/protocol/Gps103ProtocolDecoderTest.java75
-rw-r--r--test/org/traccar/protocol/GpsGateProtocolDecoderTest.java15
-rw-r--r--test/org/traccar/protocol/GpsMarkerProtocolDecoderTest.java11
-rw-r--r--test/org/traccar/protocol/GpsmtaProtocolDecoderTest.java5
-rw-r--r--test/org/traccar/protocol/Gt02ProtocolDecoderTest.java15
-rw-r--r--test/org/traccar/protocol/Gt06ProtocolDecoderTest.java68
-rw-r--r--test/org/traccar/protocol/H02ProtocolDecoderTest.java131
-rw-r--r--test/org/traccar/protocol/HaicomProtocolDecoderTest.java10
-rw-r--r--test/org/traccar/protocol/IntellitracProtocolDecoderTest.java35
-rw-r--r--test/org/traccar/protocol/Jt600ProtocolDecoderTest.java30
-rw-r--r--test/org/traccar/protocol/KhdProtocolDecoderTest.java40
-rw-r--r--test/org/traccar/protocol/LaipacProtocolDecoderTest.java55
-rw-r--r--test/org/traccar/protocol/M2mProtocolDecoderTest.java12
-rw-r--r--test/org/traccar/protocol/ManPowerProtocolDecoderTest.java8
-rw-r--r--test/org/traccar/protocol/MegastekProtocolDecoderTest.java32
-rw-r--r--test/org/traccar/protocol/MeiligaoProtocolDecoderTest.java99
-rw-r--r--test/org/traccar/protocol/MeitrackProtocolDecoderTest.java85
-rw-r--r--test/org/traccar/protocol/MiniFinderProtocolDecoderTest.java11
-rw-r--r--test/org/traccar/protocol/MtxProtocolDecoderTest.java5
-rw-r--r--test/org/traccar/protocol/MxtProtocolDecoderTest.java38
-rw-r--r--test/org/traccar/protocol/NavigilProtocolDecoderTest.java11
-rw-r--r--test/org/traccar/protocol/NavisProtocolDecoderTest.java16
-rw-r--r--test/org/traccar/protocol/NoranProtocolDecoderTest.java31
-rw-r--r--test/org/traccar/protocol/OrionProtocolDecoderTest.java22
-rw-r--r--test/org/traccar/protocol/OsmAndProtocolDecoderTest.java31
-rw-r--r--test/org/traccar/protocol/PiligrimProtocolDecoderTest.java14
-rw-r--r--test/org/traccar/protocol/ProgressProtocolDecoderTest.java14
-rw-r--r--test/org/traccar/protocol/ProtocolDecoderTest.java15
-rw-r--r--test/org/traccar/protocol/Pt3000ProtocolDecoderTest.java6
-rw-r--r--test/org/traccar/protocol/Pt502ProtocolDecoderTest.java22
-rw-r--r--test/org/traccar/protocol/RitiProtocolDecoderTest.java10
-rw-r--r--test/org/traccar/protocol/RuptelaProtocolDecoderTest.java22
-rw-r--r--test/org/traccar/protocol/SanavProtocolDecoderTest.java14
-rw-r--r--test/org/traccar/protocol/SkypatrolProtocolDecoderTest.java18
-rw-r--r--test/org/traccar/protocol/Stl060ProtocolDecoderTest.java10
-rw-r--r--test/org/traccar/protocol/SuntechProtocolDecoderTest.java31
-rw-r--r--test/org/traccar/protocol/T55ProtocolDecoderTest.java43
-rw-r--r--test/org/traccar/protocol/TaipProtocolDecoderTest.java23
-rw-r--r--test/org/traccar/protocol/TelikProtocolDecoderTest.java7
-rw-r--r--test/org/traccar/protocol/TeltonikaProtocolDecoderTest.java48
-rw-r--r--test/org/traccar/protocol/Tk102ProtocolDecoderTest.java21
-rw-r--r--test/org/traccar/protocol/Tk103ProtocolDecoderTest.java57
-rw-r--r--test/org/traccar/protocol/Tlt2hProtocolDecoderTest.java32
-rw-r--r--test/org/traccar/protocol/TopflytechProtocolDecoderTest.java5
-rw-r--r--test/org/traccar/protocol/TotemProtocolDecoderTest.java43
-rw-r--r--test/org/traccar/protocol/Tr20ProtocolDecoderTest.java7
-rw-r--r--test/org/traccar/protocol/Tr900ProtocolDecoderTest.java8
-rw-r--r--test/org/traccar/protocol/TrackboxProtocolDecoderTest.java9
-rw-r--r--test/org/traccar/protocol/TramigoProtocolDecoderTest.java12
-rw-r--r--test/org/traccar/protocol/TytanProtocolDecoderTest.java18
-rw-r--r--test/org/traccar/protocol/TzoneProtocolDecoderTest.java23
-rw-r--r--test/org/traccar/protocol/UlbotechProtocolDecoderTest.java47
-rw-r--r--test/org/traccar/protocol/V680ProtocolDecoderTest.java37
-rw-r--r--test/org/traccar/protocol/VisiontekProtocolDecoderTest.java13
-rw-r--r--test/org/traccar/protocol/WialonProtocolDecoderTest.java29
-rw-r--r--test/org/traccar/protocol/WondexProtocolDecoderTest.java16
-rw-r--r--test/org/traccar/protocol/XexunProtocolDecoderTest.java54
-rw-r--r--test/org/traccar/protocol/XirgoProtocolDecoderTest.java10
-rw-r--r--test/org/traccar/protocol/Xt013ProtocolDecoderTest.java9
-rw-r--r--test/org/traccar/protocol/YwtProtocolDecoderTest.java11
94 files changed, 1281 insertions, 1281 deletions
diff --git a/test/org/traccar/ProtocolDecoderTest.java b/test/org/traccar/ProtocolDecoderTest.java
new file mode 100644
index 000000000..96f268c50
--- /dev/null
+++ b/test/org/traccar/ProtocolDecoderTest.java
@@ -0,0 +1,169 @@
+package org.traccar;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.jboss.netty.buffer.ChannelBuffers;
+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 org.junit.Assert;
+import org.traccar.database.IdentityManager;
+import org.traccar.helper.ChannelBufferTools;
+import org.traccar.model.Device;
+import org.traccar.model.Position;
+
+import java.nio.ByteOrder;
+import java.nio.charset.Charset;
+import java.util.Date;
+import java.util.List;
+
+public class ProtocolDecoderTest {
+
+ static {
+ Context.init(new IdentityManager() {
+
+ private Device createDevice() {
+ Device device = new Device();
+ device.setId(1);
+ device.setUniqueId("123456789012345");
+ return device;
+ }
+
+ @Override
+ public Device getDeviceById(long id) {
+ return createDevice();
+ }
+
+ @Override
+ public Device getDeviceByUniqueId(String imei) {
+ return createDevice();
+ }
+
+ });
+ }
+
+ protected void verifyNothing(BaseProtocolDecoder decoder, Object object) throws Exception {
+ Assert.assertNull(decoder.decode(null, null, object));
+ }
+
+ protected void verifyAttributes(BaseProtocolDecoder decoder, Object object) throws Exception {
+ Object decodedObject = decoder.decode(null, null, object);
+ Assert.assertNotNull(decodedObject);
+ Assert.assertTrue(decodedObject instanceof Position);
+ Position position = (Position) decodedObject;
+ Assert.assertFalse(position.getAttributes().isEmpty());
+ }
+
+ protected void verifyPosition(BaseProtocolDecoder decoder, Object object) throws Exception {
+ verifyDecodedPosition(decoder.decode(null, null, object));
+ }
+
+ protected void verifyPosition(BaseProtocolDecoder decoder, Object object, Position position) throws Exception {
+ verifyDecodedPosition(decoder.decode(null, null, object), position);
+ }
+
+ protected void verifyPositions(BaseProtocolDecoder decoder, Object object) throws Exception {
+ Object decodedObject = decoder.decode(null, null, object);
+ Assert.assertNotNull(decodedObject);
+ Assert.assertTrue(decodedObject instanceof List);
+ for (Object item : (List) decodedObject) {
+ verifyDecodedPosition(item);
+ }
+ }
+
+ protected Position position(
+ Date time, boolean valid, double lat, double lon, double altitude, double speed, double course) {
+
+ Position position = new Position();
+
+ position.setDeviceTime(time);
+ position.setFixTime(time);
+ position.setValid(valid);
+ position.setLatitude(lat);
+ position.setLongitude(lon);
+ position.setAltitude(altitude);
+ position.setSpeed(speed);
+ position.setCourse(course);
+
+ return position;
+ }
+
+ protected ChannelBuffer binary(String... data) {
+ return binary(ByteOrder.BIG_ENDIAN, data);
+ }
+
+ protected ChannelBuffer binary(ByteOrder endianness, String... data) {
+ return ChannelBuffers.wrappedBuffer(
+ endianness, ChannelBufferTools.convertHexString(String.join("", data)));
+ }
+
+ protected String text(String... data) {
+ return String.join("", data);
+ }
+
+ protected ChannelBuffer buffer(String... data) {
+ return ChannelBuffers.copiedBuffer(String.join("", data), Charset.defaultCharset());
+ }
+
+ protected DefaultHttpRequest request(String url) {
+ return request(HttpMethod.GET, url);
+ }
+
+ protected DefaultHttpRequest request(HttpMethod method, String url) {
+ return new DefaultHttpRequest(HttpVersion.HTTP_1_1, method, url);
+ }
+
+ protected DefaultHttpRequest request(HttpMethod method, String url, ChannelBuffer data) {
+ DefaultHttpRequest request = new DefaultHttpRequest(HttpVersion.HTTP_1_1, method, url);
+ request.setContent(data);
+ return request;
+ }
+
+ private void verifyDecodedPosition(Object decodedObject, Position expected) {
+
+ Assert.assertNotNull(decodedObject);
+ Assert.assertTrue(decodedObject instanceof Position);
+
+ Position position = (Position) decodedObject;
+
+ Assert.assertEquals(position.getDeviceTime(), expected.getDeviceTime());
+ Assert.assertEquals(position.getFixTime(), expected.getFixTime());
+ Assert.assertEquals(position.getValid(), expected.getValid());
+ Assert.assertEquals(position.getLatitude(), expected.getLatitude(), 0.00001);
+ Assert.assertEquals(position.getLongitude(), expected.getLongitude(), 0.00001);
+ Assert.assertEquals(position.getAltitude(), expected.getAltitude(), 0.01);
+ Assert.assertEquals(position.getSpeed(), expected.getSpeed(), 0.01);
+ Assert.assertEquals(position.getCourse(), expected.getCourse(), 0.01);
+
+ verifyDecodedPosition(decodedObject);
+
+ }
+
+ private void verifyDecodedPosition(Object decodedObject) {
+
+ Assert.assertNotNull(decodedObject);
+ Assert.assertTrue(decodedObject instanceof Position);
+
+ Position position = (Position) decodedObject;
+
+ Assert.assertNotNull(position.getFixTime());
+ Assert.assertTrue(position.getFixTime().after(new Date(946684800000L))); // 2000 year
+ Assert.assertTrue(position.getFixTime().getTime() < System.currentTimeMillis() + 25 * 3600000); // 25 hours
+
+ Assert.assertTrue(position.getLatitude() >= -90);
+ Assert.assertTrue(position.getLatitude() <= 90);
+
+ Assert.assertTrue(position.getLongitude() >= -180);
+ Assert.assertTrue(position.getLongitude() <= 180);
+
+ Assert.assertTrue(position.getAltitude() >= -12262);
+ Assert.assertTrue(position.getAltitude() <= 18000);
+
+ Assert.assertTrue(position.getSpeed() >= 0);
+ Assert.assertTrue(position.getSpeed() <= 869);
+
+ Assert.assertTrue(position.getCourse() >= 0);
+ Assert.assertTrue(position.getCourse() <= 360);
+
+ }
+
+}
diff --git a/test/org/traccar/helper/DecoderVerifier.java b/test/org/traccar/helper/DecoderVerifier.java
deleted file mode 100644
index 38f73aabc..000000000
--- a/test/org/traccar/helper/DecoderVerifier.java
+++ /dev/null
@@ -1,64 +0,0 @@
-package org.traccar.helper;
-
-import java.util.Date;
-import java.util.List;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import org.traccar.model.Position;
-
-public class DecoderVerifier {
-
- private static void verifyPosition(Position position) {
-
- assertNotNull(position.getDeviceId());
-
- assertNotNull(position.getFixTime());
- assertTrue(position.getFixTime().after(new Date(946684800000L))); // 2000 year
- assertTrue(position.getFixTime().getTime() < System.currentTimeMillis() + 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.getAttributes());
-
- }
-
- 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/helper/TestIdentityManager.java b/test/org/traccar/helper/TestIdentityManager.java
deleted file mode 100644
index d279241e4..000000000
--- a/test/org/traccar/helper/TestIdentityManager.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package org.traccar.helper;
-
-import org.traccar.database.IdentityManager;
-import org.traccar.model.Device;
-
-public class TestIdentityManager implements IdentityManager {
-
- private final Device device;
-
- public TestIdentityManager() {
- device = new Device();
- device.setId(1);
- device.setUniqueId("123456789012345");
- }
-
- @Override
- public Device getDeviceById(long id) {
- return device;
- }
-
- @Override
- public Device getDeviceByUniqueId(String imei) {
- return device;
- }
-
-}
diff --git a/test/org/traccar/protocol/AdmProtocolDecoderTest.java b/test/org/traccar/protocol/AdmProtocolDecoderTest.java
index 3720afbea..125d7bdd8 100644
--- a/test/org/traccar/protocol/AdmProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/AdmProtocolDecoderTest.java
@@ -1,14 +1,10 @@
package org.traccar.protocol;
-import org.jboss.netty.buffer.ChannelBuffers;
import org.junit.Test;
-import org.traccar.helper.ChannelBufferTools;
+import org.traccar.ProtocolDecoderTest;
import java.nio.ByteOrder;
-import static org.junit.Assert.assertNull;
-import static org.traccar.helper.DecoderVerifier.verify;
-
public class AdmProtocolDecoderTest extends ProtocolDecoderTest {
@Test
@@ -16,23 +12,23 @@ public class AdmProtocolDecoderTest extends ProtocolDecoderTest {
AdmProtocolDecoder decoder = new AdmProtocolDecoder(new AdmProtocol());
- assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString(
- "010042033836313331313030323639343838320501000000000000000000000000000000000000000000000000000000000000000000000000000000000000000073"))));
+ verifyNothing(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ "010042033836313331313030323639343838320501000000000000000000000000000000000000000000000000000000000000000000000000000000000000000073"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString(
- "01002680336510002062A34C423DCF8E42A50B1700005801140767E30F568F2534107D220000"))));
+ verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ "01002680336510002062A34C423DCF8E42A50B1700005801140767E30F568F2534107D220000"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString(
- "010022003300072020000000000000000044062A330000000000107F10565D4A8310"))));
+ verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ "010022003300072020000000000000000044062A330000000000107F10565D4A8310"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString(
- "0100268033641080207AA34C424CCF8E4239030800005B01140755E30F560000F00F70220000"))));
+ verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ "0100268033641080207AA34C424CCF8E4239030800005B01140755E30F560000F00F70220000"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString(
- "01002680336510002062A34C423DCF8E42A50B1700005801140767E30F568F2534107D220000"))));
+ verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ "01002680336510002062A34C423DCF8E42A50B1700005801140767E30F568F2534107D220000"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString(
- "01002200333508202000000000000000007F0D9F030000000000E39A1056E24A8210"))));
+ verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ "01002200333508202000000000000000007F0D9F030000000000E39A1056E24A8210"));
}
diff --git a/test/org/traccar/protocol/ApelProtocolDecoderTest.java b/test/org/traccar/protocol/ApelProtocolDecoderTest.java
index 00f77511e..e65b180d4 100644
--- a/test/org/traccar/protocol/ApelProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/ApelProtocolDecoderTest.java
@@ -1,6 +1,7 @@
package org.traccar.protocol;
import org.junit.Test;
+import org.traccar.ProtocolDecoderTest;
public class ApelProtocolDecoderTest extends ProtocolDecoderTest {
@@ -10,7 +11,7 @@ public class ApelProtocolDecoderTest extends ProtocolDecoderTest {
ApelProtocolDecoder decoder = new ApelProtocolDecoder(new ApelProtocol());
/*byte[] buf1 = {0x40,0x4E,0x54,0x43,0x01,0x00,0x00,0x00,0x7B,0x00,0x00,0x00,0x13,0x00,0x44,0x34,0x2A,0x3E,0x53,0x3A,0x38,0x36,0x31,0x37,0x38,0x35,0x30,0x30,0x35,0x32,0x30,0x35,0x30,0x37,0x39};
- assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, buf1)));*/
+ verifyNothing(decoder, text( ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, buf1)));*/
//0c002900f12a00000f003235303032363533343135313036340f0033353638393530333632373938313101002000000000
//5c00380046e6a95136b693277f11b41a00172709f2ff03160002b9bc630007000000000000000000000000000000c31071090000880500000000000000000000
diff --git a/test/org/traccar/protocol/AplicomProtocolDecoderTest.java b/test/org/traccar/protocol/AplicomProtocolDecoderTest.java
index e01527bb2..0aaf7e6df 100644
--- a/test/org/traccar/protocol/AplicomProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/AplicomProtocolDecoderTest.java
@@ -2,10 +2,9 @@ package org.traccar.protocol;
import org.jboss.netty.buffer.ChannelBuffers;
import org.junit.Test;
+import org.traccar.ProtocolDecoderTest;
import org.traccar.helper.ChannelBufferTools;
-import static org.junit.Assert.assertNull;
-import static org.traccar.helper.DecoderVerifier.verify;
public class AplicomProtocolDecoderTest extends ProtocolDecoderTest {
@@ -14,29 +13,29 @@ public class AplicomProtocolDecoderTest extends ProtocolDecoderTest {
AplicomProtocolDecoder decoder = new AplicomProtocolDecoder(new AplicomProtocol());
- assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "44c3014645e8e9bada003e03fff7070055a4f24200000081000000000000000000000000000000000000000000000000000000000000000000000000000000ff00000001000000000000000044c3014645e8e9bada003e03fff77bff55a4f24300000081000000000000000000000000000000000000000000000000000000000000000000000000000000ff00300002000000000000000044c3014645e8e9bada003e03fff7690655a4f24500000081000000000000000000000000000000000000000000000000000000000000000000000000000000ff003000030000000000000000"))));
+ verifyNothing(decoder, binary(
+ "44c3014645e8e9bada003e03fff7070055a4f24200000081000000000000000000000000000000000000000000000000000000000000000000000000000000ff00000001000000000000000044c3014645e8e9bada003e03fff77bff55a4f24300000081000000000000000000000000000000000000000000000000000000000000000000000000000000ff00300002000000000000000044c3014645e8e9bada003e03fff7690655a4f24500000081000000000000000000000000000000000000000000000000000000000000000000000000000000ff003000030000000000000000"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "44c3014645e8e9d29a002d0022ff6d00f455893b4d55893b4c027a7e1500189d710800009e0000000000000000000000023300000000000000009d"))));
+ verifyPosition(decoder, binary(
+ "44c3014645e8e9d29a002d0022ff6d00f455893b4d55893b4c027a7e1500189d710800009e0000000000000000000000023300000000000000009d"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "44C20146B710C158DA002100B09F0700C054CA0EA254CA0E9C03BE0BF6015D7069070000142A600000000000000001"))));
+ verifyPosition(decoder, binary(
+ "44C20146B710C158DA002100B09F0700C054CA0EA254CA0E9C03BE0BF6015D7069070000142A600000000000000001"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "44C20143720729D6840043031fff7191C0450ef906450ef90603b20b8003b20b80066465b3870ce30f010ce30ce3003200001520000000030aa200003b13000000320300000bcb17acff0099000186a002"))));
+ verifyPosition(decoder, binary(
+ "44C20143720729D6840043031fff7191C0450ef906450ef90603b20b8003b20b80066465b3870ce30f010ce30ce3003200001520000000030aa200003b13000000320300000bcb17acff0099000186a002"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "440129D684002b0700C0450ef906450ef90603b20b8003b20b80066465b3870ce30f010ce30ce300003b130300000bcb170a"))));
+ verifyPosition(decoder, binary(
+ "440129D684002b0700C0450ef906450ef90603b20b8003b20b80066465b3870ce30f010ce30ce300003b130300000bcb170a"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "44c3014645e8e9152e008900b09f7700f4558c07e8558c07e703be0bd8015d6faf0e0000003240000000000000000f4349460107010007558c07e70000000000000002d209df028f05fffe00000000000000002eff13fe11fe1a00011000000000000010ff11ff3cff11008c00080060f41b0043502015000000000000020d0000030d0000040c0000040d0000050c0000050d0000058c"))));
+ verifyPosition(decoder, binary(
+ "44c3014645e8e9152e008900b09f7700f4558c07e8558c07e703be0bd8015d6faf0e0000003240000000000000000f4349460107010007558c07e70000000000000002d209df028f05fffe00000000000000002eff13fe11fe1a00011000000000000010ff11ff3cff11008c00080060f41b0043502015000000000000020d0000030d0000040c0000040d0000050c0000050d0000058c"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "44c20144563508385a009500b09f7700c0555ea99e555ea9b103bb569f01883ff50b00002a30f000000000000013074349460108010007555ea99e000000000000003f0000ae017605b3ff00000000010000006700d900d500000003000000000000006700d900d500000087002500c4ff0000435020150000000040512001000000000000020d0000030d0000040c0000040d0000050c0000050d0000058c0000060c"))));
+ verifyPosition(decoder, binary(
+ "44c20144563508385a009500b09f7700c0555ea99e555ea9b103bb569f01883ff50b00002a30f000000000000013074349460108010007555ea99e000000000000003f0000ae017605b3ff00000000010000006700d900d500000003000000000000006700d900d500000087002500c4ff0000435020150000000040512001000000000000020d0000030d0000040c0000040d0000050c0000050d0000058c0000060c"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "44C20146B710C158DA009500B09F7700C054CA0EA454CA0EA403BE0BF6015D706B070000142A600000000000000002434946010801000754CA0EA4000000000000008400000000000000000000000000000000300000FE00FE0000000000000000000000000000000000000000000000000000000000000000000040502035000000000000020D0000030D0000040C0000040D0000050C0000050D0000058C0000060C"))));
+ verifyPosition(decoder, binary(
+ "44C20146B710C158DA009500B09F7700C054CA0EA454CA0EA403BE0BF6015D706B070000142A600000000000000002434946010801000754CA0EA4000000000000008400000000000000000000000000000000300000FE00FE0000000000000000000000000000000000000000000000000000000000000000000040502035000000000000020D0000030D0000040C0000040D0000050C0000050D0000058C0000060C"));
}
diff --git a/test/org/traccar/protocol/AquilaProtocolDecoderTest.java b/test/org/traccar/protocol/AquilaProtocolDecoderTest.java
index 8a0d8bdfd..b906bfe98 100644
--- a/test/org/traccar/protocol/AquilaProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/AquilaProtocolDecoderTest.java
@@ -1,7 +1,7 @@
package org.traccar.protocol;
import org.junit.Test;
-import static org.traccar.helper.DecoderVerifier.verify;
+import org.traccar.ProtocolDecoderTest;
public class AquilaProtocolDecoderTest extends ProtocolDecoderTest {
@@ -10,16 +10,16 @@ public class AquilaProtocolDecoderTest extends ProtocolDecoderTest {
AquilaProtocolDecoder decoder = new AquilaProtocolDecoder(new AquilaProtocol());
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"$$SRINI_1MS,141214807,1,12.963515,77.533844,150925161628,A,27,0,8,0,68,0,0,0,0,0,0,0,0,1,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,*43"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"$$CLIENT_1ZF,130329214,1,12.962985,77.576484,140127165433,A,22,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,*26"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"$$CLIENT_1WP,141216511,3,12.963123,77.534012,150908163534,A,31,0,0,0,7,0,0,0,0,0,0,0,1,0,1,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,1,1,0,*28"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"$$CLIENT_1WP,141216511,3,12.963212,77.533989,150908164041,V,31,0,0,0,8,0,0,0,0,0,0,0,1,0,1,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,1,1,0,*2A"));
}
diff --git a/test/org/traccar/protocol/Ardi01ProtocolDecoderTest.java b/test/org/traccar/protocol/Ardi01ProtocolDecoderTest.java
index daaec0ae5..be5578683 100644
--- a/test/org/traccar/protocol/Ardi01ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/Ardi01ProtocolDecoderTest.java
@@ -1,8 +1,7 @@
package org.traccar.protocol;
import org.junit.Test;
-
-import static org.traccar.helper.DecoderVerifier.verify;
+import org.traccar.ProtocolDecoderTest;
public class Ardi01ProtocolDecoderTest extends ProtocolDecoderTest {
@@ -11,7 +10,7 @@ public class Ardi01ProtocolDecoderTest extends ProtocolDecoderTest {
Ardi01ProtocolDecoder decoder = new Ardi01ProtocolDecoder(new Ardi01Protocol());
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"013227003054776,20141010052719,24.4736042,56.8445807,110,289,40,7,5,78,-1"));
}
diff --git a/test/org/traccar/protocol/AtrackProtocolDecoderTest.java b/test/org/traccar/protocol/AtrackProtocolDecoderTest.java
index d404213f5..503998ca8 100644
--- a/test/org/traccar/protocol/AtrackProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/AtrackProtocolDecoderTest.java
@@ -1,10 +1,9 @@
package org.traccar.protocol;
import org.jboss.netty.buffer.ChannelBuffers;
-import static org.junit.Assert.assertNull;
import org.junit.Test;
+import org.traccar.ProtocolDecoderTest;
import org.traccar.helper.ChannelBufferTools;
-import static org.traccar.helper.DecoderVerifier.verify;
public class AtrackProtocolDecoderTest extends ProtocolDecoderTest {
@@ -13,24 +12,24 @@ public class AtrackProtocolDecoderTest extends ProtocolDecoderTest {
AtrackProtocolDecoder decoder = new AtrackProtocolDecoder(new AtrackProtocol());
- assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "fe0200014104d8f196820001"))));
+ verifyNothing(decoder, binary(
+ "fe0200014104d8f196820001"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "4050993f005c000200014104d8f19682525666c252568c3c52568c63ffc8338402698885000002000009cf03de0100000000000007d007d000525666c252568c5a52568c63ffc8338402698885000002000009cf03de0100000000000007d007d000"))));
+ verifyPositions(decoder, binary(
+ "4050993f005c000200014104d8f19682525666c252568c3c52568c63ffc8338402698885000002000009cf03de0100000000000007d007d000525666c252568c5a52568c63ffc8338402698885000002000009cf03de0100000000000007d007d000"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "40501e58003301e000014104d8f19682525ecd5d525ee344525ee35effc88815026ab4d70000020000104403de01000b0000000007d007d000"))));
+ verifyPositions(decoder, binary(
+ "40501e58003301e000014104d8f19682525ecd5d525ee344525ee35effc88815026ab4d70000020000104403de01000b0000000007d007d000"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "40501e58003301e000014104d8f19682525ecd5d525ee344525ee35effc88815026ab4d70000020000104403de01000b0000000007d007d000000000000000"))));
+ verifyPositions(decoder, binary(
+ "40501e58003301e000014104d8f19682525ecd5d525ee344525ee35effc88815026ab4d70000020000104403de01000b0000000007d007d000000000000000"));
// 7-byte date
- //verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- // "0203b494003c00eb00014104d8dd3a3e07de011b0b1f0307de011b0b1f0307de011b0b1f0300307f28030574d30000020000000600160100020000000007d007d000"))));
+ //verifyPosition(decoder, binary(
+ // "0203b494003c00eb00014104d8dd3a3e07de011b0b1f0307de011b0b1f0307de011b0b1f0300307f28030574d30000020000000600160100020000000007d007d000"));
- //verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- // "4050d2c500da055200014104d8f19682530755515307555053075581ffbba66a0231295c001902000000da000a0100830000000007d007d000000000001200080e090085530755605307555f53075582ffbbb04102313b4b001802000000e0000c0100850000000007d007d000000000001200080d0000865307556f5307556e53075582ffbbbbea02314b49002402000000e5000a01007b0000000007d007d000000000001200080d0200855307557e5307557d53075582ffbbc98702315982002502000000ea000901007a0000000007d007d000000000001300180d08007b"))));
+ //verifyPosition(decoder, binary(
+ // "4050d2c500da055200014104d8f19682530755515307555053075581ffbba66a0231295c001902000000da000a0100830000000007d007d000000000001200080e090085530755605307555f53075582ffbbb04102313b4b001802000000e0000c0100850000000007d007d000000000001200080d0000865307556f5307556e53075582ffbbbbea02314b49002402000000e5000a01007b0000000007d007d000000000001200080d0200855307557e5307557d53075582ffbbc98702315982002502000000ea000901007a0000000007d007d000000000001300180d08007b"));
}
diff --git a/test/org/traccar/protocol/AutoFon45ProtocolDecoderTest.java b/test/org/traccar/protocol/AutoFon45ProtocolDecoderTest.java
index b90fda918..50df04117 100644
--- a/test/org/traccar/protocol/AutoFon45ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/AutoFon45ProtocolDecoderTest.java
@@ -2,20 +2,19 @@ package org.traccar.protocol;
import org.jboss.netty.buffer.ChannelBuffers;
import org.junit.Test;
+import org.traccar.ProtocolDecoderTest;
import org.traccar.helper.ChannelBufferTools;
-import static org.junit.Assert.assertNull;
-import static org.traccar.helper.DecoderVerifier.verify;
public class AutoFon45ProtocolDecoderTest extends ProtocolDecoderTest {
@Test
public void testDecode() throws Exception {
AutoFon45ProtocolDecoder decoder = new AutoFon45ProtocolDecoder(new AutoFon45Protocol());
- assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "41032125656985547543619173484002123481"))));
+ verifyNothing(decoder, binary(
+ "41032125656985547543619173484002123481"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "023E00001E004D411EFA01772F185285009C48041F1E366C2961380F26B10B00911C"))));
+ verifyPosition(decoder, binary(
+ "023E00001E004D411EFA01772F185285009C48041F1E366C2961380F26B10B00911C"));
}
}
diff --git a/test/org/traccar/protocol/AutoFonProtocolDecoderTest.java b/test/org/traccar/protocol/AutoFonProtocolDecoderTest.java
index f0a1611bf..0ae3950ce 100644
--- a/test/org/traccar/protocol/AutoFonProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/AutoFonProtocolDecoderTest.java
@@ -2,10 +2,9 @@ package org.traccar.protocol;
import org.jboss.netty.buffer.ChannelBuffers;
import org.junit.Test;
+import org.traccar.ProtocolDecoderTest;
import org.traccar.helper.ChannelBufferTools;
-import static org.junit.Assert.assertNull;
-import static org.traccar.helper.DecoderVerifier.verify;
public class AutoFonProtocolDecoderTest extends ProtocolDecoderTest {
@@ -14,14 +13,14 @@ public class AutoFonProtocolDecoderTest extends ProtocolDecoderTest {
AutoFonProtocolDecoder decoder = new AutoFonProtocolDecoder(new AutoFonProtocol());
- assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "10556103592310314825728F"))));
+ verifyNothing(decoder, binary(
+ "10556103592310314825728F"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "111E00000000000000000100007101010B0C020302010B0C0005A053FFFFFFFF02010B0C00276047FFFFFFFF1F5600FA000176F218C7850C0B0B0C203A033DBD46035783EF009E00320014FFFF45"))));
+ verifyPosition(decoder, binary(
+ "111E00000000000000000100007101010B0C020302010B0C0005A053FFFFFFFF02010B0C00276047FFFFFFFF1F5600FA000176F218C7850C0B0B0C203A033DBD46035783EF009E00320014FFFF45"));
- //verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- // "12060000007501010B0C00089CFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000003E7FFFF02007601010B0C00269CFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000003E7FFFF4A007601010B0C01089CFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000003E7FFFF04007501010B0C01269CFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000003E7FFFF80007601010B0C02089CFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000003E7FFFFA6007501010B0C02231F5600FA000176F218C70000000000000000000000000000000000000003E7FFFF9629"))));
+ //verifyPosition(decoder, binary(
+ // "12060000007501010B0C00089CFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000003E7FFFF02007601010B0C00269CFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000003E7FFFF4A007601010B0C01089CFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000003E7FFFF04007501010B0C01269CFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000003E7FFFF80007601010B0C02089CFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000003E7FFFFA6007501010B0C02231F5600FA000176F218C70000000000000000000000000000000000000003E7FFFF9629"));
}
diff --git a/test/org/traccar/protocol/Avl301ProtocolDecoderTest.java b/test/org/traccar/protocol/Avl301ProtocolDecoderTest.java
index b431fa868..b8f09bb35 100644
--- a/test/org/traccar/protocol/Avl301ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/Avl301ProtocolDecoderTest.java
@@ -2,10 +2,9 @@ package org.traccar.protocol;
import org.jboss.netty.buffer.ChannelBuffers;
import org.junit.Test;
+import org.traccar.ProtocolDecoderTest;
import org.traccar.helper.ChannelBufferTools;
-import static org.junit.Assert.assertNull;
-import static org.traccar.helper.DecoderVerifier.verify;
public class Avl301ProtocolDecoderTest extends ProtocolDecoderTest {
@@ -14,14 +13,14 @@ public class Avl301ProtocolDecoderTest extends ProtocolDecoderTest {
Avl301ProtocolDecoder decoder = new Avl301ProtocolDecoder(new Avl301Protocol());
- assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "244c0f086058500087335500010d0a"))));
+ verifyNothing(decoder, binary(
+ "244c0f086058500087335500010d0a"));
- assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "24480d1001c3065c0d00010d0a"))));
+ verifyNothing(decoder, binary(
+ "24480d1001c3065c0d00010d0a"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "24242c0f041710001d0e060146944904ff4ac40000148f0651044b001a081001be06590daa00000108a30d0a"))));
+ verifyPosition(decoder, binary(
+ "24242c0f041710001d0e060146944904ff4ac40000148f0651044b001a081001be06590daa00000108a30d0a"));
}
diff --git a/test/org/traccar/protocol/BceProtocolDecoderTest.java b/test/org/traccar/protocol/BceProtocolDecoderTest.java
index 811a912b8..1718ad3f4 100644
--- a/test/org/traccar/protocol/BceProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/BceProtocolDecoderTest.java
@@ -4,8 +4,8 @@ import java.nio.ByteOrder;
import org.jboss.netty.buffer.ChannelBuffers;
import org.junit.Test;
+import org.traccar.ProtocolDecoderTest;
import org.traccar.helper.ChannelBufferTools;
-import static org.traccar.helper.DecoderVerifier.verify;
public class BceProtocolDecoderTest extends ProtocolDecoderTest {
@@ -14,23 +14,23 @@ public class BceProtocolDecoderTest extends ProtocolDecoderTest {
BceProtocolDecoder decoder = new BceProtocolDecoder(new BceProtocol());
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString(
- "be76619c834601004200a0003fd769c568ffc3db0079161d420683a9414918b1150000000000d102660167040000000000009f06357f0000a401042ea415e10232000000000000000000000051"))));
+ verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ "be76619c834601004200a0003fd769c568ffc3db0079161d420683a9414918b1150000000000d102660167040000000000009f06357f0000a401042ea415e10232000000000000000000000051"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString(
- "be76619c834601004200a0003ff76cc568ffc3db00bd151d423c8ca9410a18af150000000000d1023a0160040000000000009f06427f0000a401042ea416e1003e00000000000000000000009a"))));
+ verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ "be76619c834601004200a0003ff76cc568ffc3db00bd151d423c8ca9410a18af150000000000d1023a0160040000000000009f06427f0000a401042ea416e1003e00000000000000000000009a"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString(
- "be76619c834601004202a5863f57f8b868ffc3db0001712642b70b9d41221946200246d23342d1023e016404000000000000a0065a7f0000a4010496f277e3064300000000000000000000003f97f8b868ffc3db0074712642ae0a9d412919452102fff19042d102a4026304000000000000a006487f0000a4010496f277e3064300000000000000000000003fb7f8b868ffc3db00c6712642000a9d413019442002a6074542d102300165040000000000009f064f7f0000a4010496f277e3064300000000000000000000003fd7f8b868ffc3db002872264245099d413518421f02bea35e42d1021e0164040000000000009f06377f0000a4010496f277e3064300000000000000000000003fe7f8b868ffc3db0061722642e3089d413a28421f02a05ff641d102580163040000000000009f06577f0000a4010496f277e3064300000000000000000000003f17f9b868ffc3db0021732642a3079d414119411d02d69fcc42d102440165040000000000009f06437f0000a4010496f277e3064300000000000000000000003f37f9b868ffc3db00ae732642b4069d414628421b02e0629742d1024c0167040000000000009f06557f0000a4010496f277e3064300000000000000000000003f57f9b868ffc3db0044742642ae059d414c28421a027540a342d102860163040000000000009f065b7f0000a4010496f277e3064300000000000000000000003f97f9b868ffc3db007275264256039d4153284417029e1f2f43d1024a016704000000000000a0064e7f0000a4010496f277e306430000000000000000000000db"))));
+ verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ "be76619c834601004202a5863f57f8b868ffc3db0001712642b70b9d41221946200246d23342d1023e016404000000000000a0065a7f0000a4010496f277e3064300000000000000000000003f97f8b868ffc3db0074712642ae0a9d412919452102fff19042d102a4026304000000000000a006487f0000a4010496f277e3064300000000000000000000003fb7f8b868ffc3db00c6712642000a9d413019442002a6074542d102300165040000000000009f064f7f0000a4010496f277e3064300000000000000000000003fd7f8b868ffc3db002872264245099d413518421f02bea35e42d1021e0164040000000000009f06377f0000a4010496f277e3064300000000000000000000003fe7f8b868ffc3db0061722642e3089d413a28421f02a05ff641d102580163040000000000009f06577f0000a4010496f277e3064300000000000000000000003f17f9b868ffc3db0021732642a3079d414119411d02d69fcc42d102440165040000000000009f06437f0000a4010496f277e3064300000000000000000000003f37f9b868ffc3db00ae732642b4069d414628421b02e0629742d1024c0167040000000000009f06557f0000a4010496f277e3064300000000000000000000003f57f9b868ffc3db0044742642ae059d414c28421a027540a342d102860163040000000000009f065b7f0000a4010496f277e3064300000000000000000000003f97f9b868ffc3db007275264256039d4153284417029e1f2f43d1024a016704000000000000a0064e7f0000a4010496f277e306430000000000000000000000db"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString(
- "2d41abfa2e4501004e02a5a0068609f96a009106260af96a00a006260af96a009106960af96a00a306a60af96a008f06b60af96a009106960cf96a00a03e0715f96affc300804000e6a23a4230ccc441001f47850200000000a0000000bd6542651a110d004b1000000000a401045a56bf4d02480000000000000000061623f96a00a0062623f96a00913ea728f96affc300804000e6a23a4230ccc441001f7f850200000000a0000000bd6542651a110d004a1000000000a401045a56bf4d02480000000000000000069639f96a00a006a639f96a00913e373cf96affc300804000e6a23a4230ccc441001f7f850200000000a0000000ad6534651a110d004a1000000000a401045a56bf4d024800000000000000003ed74ff96affc300804000e6a23a4230ccc441001f7f850200000000a0000000ad6534651a111b004a1000000000a401045a56bf4d01480000000000000000061650f96a00a0062650f96a00913e6763f96affc300804000e6a23a4230ccc441001f7f850200000000a0000000ad6534651a110d004a1000000000a401045a56bf4d01480000000000000000069666f96a00a006a666f96a00913e0777f96affc300804000e6a23a4230ccc441001f7f850200000000a0000000ad6534651a110d004a1000000000a401045a56bf4d0148000000000000000006067df96a00a006167df96a0091063687f96a00a3064687f96a008f065687f96a0091063689f96a00a03e978af96affc300804000e6a23a4230ccc441001f87850200000000a0000000ad6527651a110d004a1000000000a401045a56bf4d024800000000000000000e"))));
+ verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ "2d41abfa2e4501004e02a5a0068609f96a009106260af96a00a006260af96a009106960af96a00a306a60af96a008f06b60af96a009106960cf96a00a03e0715f96affc300804000e6a23a4230ccc441001f47850200000000a0000000bd6542651a110d004b1000000000a401045a56bf4d02480000000000000000061623f96a00a0062623f96a00913ea728f96affc300804000e6a23a4230ccc441001f7f850200000000a0000000bd6542651a110d004a1000000000a401045a56bf4d02480000000000000000069639f96a00a006a639f96a00913e373cf96affc300804000e6a23a4230ccc441001f7f850200000000a0000000ad6534651a110d004a1000000000a401045a56bf4d024800000000000000003ed74ff96affc300804000e6a23a4230ccc441001f7f850200000000a0000000ad6534651a111b004a1000000000a401045a56bf4d01480000000000000000061650f96a00a0062650f96a00913e6763f96affc300804000e6a23a4230ccc441001f7f850200000000a0000000ad6534651a110d004a1000000000a401045a56bf4d01480000000000000000069666f96a00a006a666f96a00913e0777f96affc300804000e6a23a4230ccc441001f7f850200000000a0000000ad6534651a110d004a1000000000a401045a56bf4d0148000000000000000006067df96a00a006167df96a0091063687f96a00a3064687f96a008f065687f96a0091063689f96a00a03e978af96affc300804000e6a23a4230ccc441001f87850200000000a0000000ad6527651a110d004a1000000000a401045a56bf4d024800000000000000000e"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString(
- "be76619c834601003302a5e8327764726bff432fc52a420e2c93410028afd2070000000080024a0005040000000000008e06547f0000a401043cf21f390e54328764726bff432fc52a420e2c93410028afd2070000000080024c0005040000000000008e064f7f0000a401043cf21f390e54329764726bff432fc52a420e2c93410028afd2070000000080024e0002040000000000008d064f7f0000a401043cf21f390e5432a764726bff432fc52a420e2c93410028afd2070000000080024e0004040000000000008e06587f0000a401043cf21f390e5432b764726bff432fc52a420e2c93410028afd207000000008002460005040000000000008e06557f0000a401043cf21f390e5432c764726bff432fc52a420e2c93410028afd2070000000080024e0004040000000000008e06347f0000a401043cf21f390e5432d764726bff432fc52a420e2c93410028afd2070000000080024e0002040000000000008e06547f0000a401043cf21f390e5432e764726bff432fc52a420e2c93410028afd207000000008002540002040000000000008e06477f0000a401043cf21f390e5432f764726bff432fc52a420e2c93410028afd207000000008002540004040000000000008d064f7f0000a401043cf21f390e54320765726bff432fc52a420e2c93410028afd207000000008002540004040000000000008e064d7f0000a401043cf21f390e54321765726bff432fc52a420e2c93410028afd207000000008002540004040000000000008e06467f0000a401043cf21f390e544200a0003f3743c96bffc3db0060c81c42d885ab41002aaf060000000000d102380167040000000000008a064f7f0000a4010412a46b330033000000000000000000000025"))));
+ verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ "be76619c834601003302a5e8327764726bff432fc52a420e2c93410028afd2070000000080024a0005040000000000008e06547f0000a401043cf21f390e54328764726bff432fc52a420e2c93410028afd2070000000080024c0005040000000000008e064f7f0000a401043cf21f390e54329764726bff432fc52a420e2c93410028afd2070000000080024e0002040000000000008d064f7f0000a401043cf21f390e5432a764726bff432fc52a420e2c93410028afd2070000000080024e0004040000000000008e06587f0000a401043cf21f390e5432b764726bff432fc52a420e2c93410028afd207000000008002460005040000000000008e06557f0000a401043cf21f390e5432c764726bff432fc52a420e2c93410028afd2070000000080024e0004040000000000008e06347f0000a401043cf21f390e5432d764726bff432fc52a420e2c93410028afd2070000000080024e0002040000000000008e06547f0000a401043cf21f390e5432e764726bff432fc52a420e2c93410028afd207000000008002540002040000000000008e06477f0000a401043cf21f390e5432f764726bff432fc52a420e2c93410028afd207000000008002540004040000000000008d064f7f0000a401043cf21f390e54320765726bff432fc52a420e2c93410028afd207000000008002540004040000000000008e064d7f0000a401043cf21f390e54321765726bff432fc52a420e2c93410028afd207000000008002540004040000000000008e06467f0000a401043cf21f390e544200a0003f3743c96bffc3db0060c81c42d885ab41002aaf060000000000d102380167040000000000008a064f7f0000a4010412a46b330033000000000000000000000025"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString(
- "ca07629c834601002702a58f3c278ff96a0bc000a0c00140bc3a42508bc541002a70a905000000009000c101a40103d904440e003000000000000000000000000000000000000001013c878ff96a0bc000a0c00140bc3a42508bc541002970a905000000009000c301a40103d904440e003000000000000000000000000000000000000001013cb7d2f96a0bc000a0c00124bc3a426b8fc5410428000404000000009000c401a40103d904440e003500000000000000000000000000000000000001013cc7d2f96a0bc000a0c00124bc3a426b8fc5410428000404000000009000c301a40103d904440e003500000000000000000000000000000000000001013cd7f2f96a0bc000a0c00114bc3a42a48fc5410029027e03000000009000c301a40103d904440e003000000000000000000000000000000000000001013c670dfa6a0bc000a0c001f1bb3a42418dc541002a484904000000009000c001a40103d904440e003a00000000000000000000000000000000000001013c770dfa6a0bc000a0c001f1bb3a42418dc5410028484904000000009000bf01a40103d904440e003a00000000000000000000000000000000000001013c470efa6a0bc000a0c001f1bb3a42418dc5410029484904000000009000bf01a40103d904440e003a00000000000000000000000000000000000001013c5711fa6a0bc000a0c001f1bb3a42418dc5410029484904000000009000c101a40103d904440e003000000000000000000000000000000000000001013f00a0003cc795866b0bc000a0c00144bc3a423a90c541003697cb03000000008000cf01a40103d9040d0f0030000000000000000000000000000000000000010100"))));
+ verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ "ca07629c834601002702a58f3c278ff96a0bc000a0c00140bc3a42508bc541002a70a905000000009000c101a40103d904440e003000000000000000000000000000000000000001013c878ff96a0bc000a0c00140bc3a42508bc541002970a905000000009000c301a40103d904440e003000000000000000000000000000000000000001013cb7d2f96a0bc000a0c00124bc3a426b8fc5410428000404000000009000c401a40103d904440e003500000000000000000000000000000000000001013cc7d2f96a0bc000a0c00124bc3a426b8fc5410428000404000000009000c301a40103d904440e003500000000000000000000000000000000000001013cd7f2f96a0bc000a0c00114bc3a42a48fc5410029027e03000000009000c301a40103d904440e003000000000000000000000000000000000000001013c670dfa6a0bc000a0c001f1bb3a42418dc541002a484904000000009000c001a40103d904440e003a00000000000000000000000000000000000001013c770dfa6a0bc000a0c001f1bb3a42418dc5410028484904000000009000bf01a40103d904440e003a00000000000000000000000000000000000001013c470efa6a0bc000a0c001f1bb3a42418dc5410029484904000000009000bf01a40103d904440e003a00000000000000000000000000000000000001013c5711fa6a0bc000a0c001f1bb3a42418dc5410029484904000000009000c101a40103d904440e003000000000000000000000000000000000000001013f00a0003cc795866b0bc000a0c00144bc3a423a90c541003697cb03000000008000cf01a40103d9040d0f0030000000000000000000000000000000000000010100"));
}
diff --git a/test/org/traccar/protocol/BlackKiteProtocolDecoderTest.java b/test/org/traccar/protocol/BlackKiteProtocolDecoderTest.java
index 8ccf9f6a8..0da04177a 100644
--- a/test/org/traccar/protocol/BlackKiteProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/BlackKiteProtocolDecoderTest.java
@@ -2,10 +2,9 @@ package org.traccar.protocol;
import java.nio.ByteOrder;
import org.jboss.netty.buffer.ChannelBuffers;
-import static org.junit.Assert.assertNull;
import org.junit.Test;
+import org.traccar.ProtocolDecoderTest;
import org.traccar.helper.ChannelBufferTools;
-import static org.traccar.helper.DecoderVerifier.verify;
public class BlackKiteProtocolDecoderTest extends ProtocolDecoderTest {
@@ -14,11 +13,11 @@ public class BlackKiteProtocolDecoderTest extends ProtocolDecoderTest {
BlackKiteProtocolDecoder decoder = new BlackKiteProtocolDecoder(new BlackKiteProtocol());
- assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString(
- "01150003313131313131313131313131313131209836055605BA"))));
+ verifyNothing(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ "01150003313131313131313131313131313131209836055605BA"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString(
- "0136000331313131313131313131313131313120523905563000010000000100000033000000003400004000004500004600005000005100009F76"))));
+ verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ "0136000331313131313131313131313131313120523905563000010000000100000033000000003400004000004500004600005000005100009F76"));
}
diff --git a/test/org/traccar/protocol/BoxProtocolDecoderTest.java b/test/org/traccar/protocol/BoxProtocolDecoderTest.java
index 9aacc85f0..86013e9f8 100644
--- a/test/org/traccar/protocol/BoxProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/BoxProtocolDecoderTest.java
@@ -1,8 +1,8 @@
package org.traccar.protocol;
-import static org.junit.Assert.assertNull;
-import static org.traccar.helper.DecoderVerifier.verify;
+
import org.junit.Test;
+import org.traccar.ProtocolDecoderTest;
public class BoxProtocolDecoderTest extends ProtocolDecoderTest {
@@ -11,52 +11,52 @@ public class BoxProtocolDecoderTest extends ProtocolDecoderTest {
BoxProtocolDecoder decoder = new BoxProtocolDecoder(new BoxProtocol());
- assertNull(decoder.decode(null, null,
+ verifyNothing(decoder, text(
"H,BT,358281002435893,081028142432,F5813D19,6D6E6DC2"));
- assertNull(decoder.decode(null, null,
+ verifyNothing(decoder, text(
"H,BT,N878123,080415081234,D63E6DD9,6D6E6DC2,8944100300825505377"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"L,081028142429,G,52.51084,-1.70849,0,170,0,1,0"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"L,081028142432,G,52.51081,-1.70849,0,203,0,16,0"));
- assertNull(decoder.decode(null, null,
+ verifyNothing(decoder, text(
"L,080528112501,AI1,145.56"));
- assertNull(decoder.decode(null, null,
+ verifyNothing(decoder, text(
"E,1"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"L,150728150130,G,24.68312,46.67526,0,140,0,3,20;A,0;D,0;I,0"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"L,150728155815,G,24.68311,46.67528,0,140,0,6,21;A,0;D,0;I,0"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"L,150728155833,G,24.68311,46.67528,11,140,0,52,23;A,0.79;D,0;I,0"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"L,150728155934,G,24.68396,46.67489,0,282,0.12,1,21;A,1.27;D,1.23;I,0"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"L,150728160033,G,24.68414,46.67485,0,282,0.12,1,21;A,0;D,0;I,0"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"L,150728160133,G,24.68388,46.675,0,282,0.12,1,21;A,0;D,0;I,0"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"L,150728160233,G,24.68377,46.67501,0,282,0.12,1,21;A,0;D,0;I,0"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"L,150728160333,G,24.684,46.67488,0,282,0.12,1,21;A,0;D,0;I,0"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"L,150728155855,G,24.68413,46.67482,0,282,0.14,53,21;A,0;D,0;I,0"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"L,150728160400,G,24.68413,46.67482,0,282,0.14,7,20;A,0;D,0;I,0;END,25,326,150728155814"));
}
diff --git a/test/org/traccar/protocol/CalAmpProtocolDecoderTest.java b/test/org/traccar/protocol/CalAmpProtocolDecoderTest.java
index 77202d7b7..c2acbe5b9 100644
--- a/test/org/traccar/protocol/CalAmpProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/CalAmpProtocolDecoderTest.java
@@ -1,10 +1,9 @@
package org.traccar.protocol;
import org.jboss.netty.buffer.ChannelBuffers;
-import static org.junit.Assert.assertNull;
import org.junit.Test;
+import org.traccar.ProtocolDecoderTest;
import org.traccar.helper.ChannelBufferTools;
-import static org.traccar.helper.DecoderVerifier.verify;
public class CalAmpProtocolDecoderTest extends ProtocolDecoderTest {
@@ -13,26 +12,26 @@ public class CalAmpProtocolDecoderTest extends ProtocolDecoderTest {
CalAmpProtocolDecoder decoder = new CalAmpProtocolDecoder(new CalAmpProtocol());
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "830543321494860101010a0080560b5a5e0eadd0291becf3c500f005090f1f3305000003010040c0a600000000000000008b12a102"))));
+ verifyPosition(decoder, binary(
+ "830543321494860101010a0080560b5a5e0eadd0291becf3c500f005090f1f3305000003010040c0a600000000000000008b12a102"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "830543321494860101010a0c215608b6680ead5ada1bed88d300000049801f000500000300003cf33200000000000000008b0ce101"))));
+ verifyPosition(decoder, binary(
+ "830543321494860101010a0c215608b6680ead5ada1bed88d300000049801f000500000300003cf33200000000000000008b0ce101"));
- assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "830545321041830101010300010000333862000023c301000000004532104183ffffff353816051610691f420040163953294fffffffffffffffff8996604211639032949f4f54413a317c303b302c317c343b302c34004f5441535441543a302c302c302c302c302c222200564255533a342c322e302e302c343533323130343138332c5630312e30332e30312e34302c5630312e30332e30312e33312c2c0056494e2d494e464f3a56494e3d31464d5a5537324539355a4137303032362c4445562d5245474e3d55532c535256522d5245474e3d555300"))));
+ verifyNothing(decoder, binary(
+ "830545321041830101010300010000333862000023c301000000004532104183ffffff353816051610691f420040163953294fffffffffffffffff8996604211639032949f4f54413a317c303b302c317c343b302c34004f5441535441543a302c302c302c302c302c222200564255533a342c322e302e302c343533323130343138332c5630312e30332e30312e34302c5630312e30332e30312e33312c2c0056494e2d494e464f3a56494e3d31464d5a5537324539355a4137303032362c4445562d5245474e3d55532c535256522d5245474e3d555300"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "8308353301059723580f01020102088952d994c352d994c4134fa767c4c482e20000c12700000d29006e1002019affc90f061d00060c0000"))));
+ verifyPosition(decoder, binary(
+ "8308353301059723580f01020102088952d994c352d994c4134fa767c4c482e20000c12700000d29006e1002019affc90f061d00060c0000"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "8308355233050116134f01020102445652d993e152d993e1124c728cc68f0647000023c00000000000000e02019affc90f071c0015020000"))));
+ verifyPosition(decoder, binary(
+ "8308355233050116134f01020102445652d993e152d993e1124c728cc68f0647000023c00000000000000e02019affc90f071c0015020000"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "830545420185450101010200075517fb335516c5c40fb1aea4cf4cbf250000000000000000008900260015ffb10f001108110a0000"))));
+ verifyPosition(decoder, binary(
+ "830545420185450101010200075517fb335516c5c40fb1aea4cf4cbf250000000000000000008900260015ffb10f001108110a0000"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "830543321494750101010A00085492798A0EC4F9E71BDA3B81005600040F1F33050000030000000076000000000000000000000000"))));
+ verifyPosition(decoder, binary(
+ "830543321494750101010A00085492798A0EC4F9E71BDA3B81005600040F1F33050000030000000076000000000000000000000000"));
}
diff --git a/test/org/traccar/protocol/CarTrackProtocolDecoderTest.java b/test/org/traccar/protocol/CarTrackProtocolDecoderTest.java
index 1180ac6f2..6b26607d7 100644
--- a/test/org/traccar/protocol/CarTrackProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/CarTrackProtocolDecoderTest.java
@@ -1,7 +1,7 @@
package org.traccar.protocol;
-import static org.traccar.helper.DecoderVerifier.verify;
import org.junit.Test;
+import org.traccar.ProtocolDecoderTest;
public class CarTrackProtocolDecoderTest extends ProtocolDecoderTest {
@@ -10,10 +10,10 @@ public class CarTrackProtocolDecoderTest extends ProtocolDecoderTest {
CarTrackProtocolDecoder decoder = new CarTrackProtocolDecoder(new CarTrackProtocol());
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"$$2222234???????&A9955&B102904.000,A,2233.0655,N,11404.9440,E,0.00,,030109,,*17|6.3|&C0100000100&D000024?>&E10000000&Y00100020"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"$$2222234???????&A9955&B102904.000,A,2233.0655,N,11404.9440,E,0.00,,030109,,*17|6.3|&C0100000100&D000024?>&E10000000"));
diff --git a/test/org/traccar/protocol/CarscopProtocolDecoderTest.java b/test/org/traccar/protocol/CarscopProtocolDecoderTest.java
index 452797e1b..eff28224f 100644
--- a/test/org/traccar/protocol/CarscopProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/CarscopProtocolDecoderTest.java
@@ -1,8 +1,7 @@
package org.traccar.protocol;
-import static org.traccar.helper.DecoderVerifier.verify;
-
import org.junit.Test;
+import org.traccar.ProtocolDecoderTest;
public class CarscopProtocolDecoderTest extends ProtocolDecoderTest {
@@ -11,16 +10,16 @@ public class CarscopProtocolDecoderTest extends ProtocolDecoderTest {
CarscopProtocolDecoder decoder = new CarscopProtocolDecoder(new CarscopProtocol());
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"*040331141830UB05123456789012345061825A2934.0133N10627.2544E000.0040331309.6200000000L000000"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"*040331141830UB04999999984061825A2934.0133N10627.2544E000.0040331309.6200000000L000000"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"*040331141830UA012Hi-jack061825A2934.0133N10627.2544E000.0040331309.6200000000L000000"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"*150817160254UB05CC8011400042499160254A2106.8799S14910.2583E000.0150817158.3511111111L000000"));
}
diff --git a/test/org/traccar/protocol/CastelProtocolDecoderTest.java b/test/org/traccar/protocol/CastelProtocolDecoderTest.java
index 38e76d4b7..be4cab227 100644
--- a/test/org/traccar/protocol/CastelProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/CastelProtocolDecoderTest.java
@@ -2,10 +2,9 @@ package org.traccar.protocol;
import java.nio.ByteOrder;
import org.jboss.netty.buffer.ChannelBuffers;
-import static org.junit.Assert.assertNull;
import org.junit.Test;
+import org.traccar.ProtocolDecoderTest;
import org.traccar.helper.ChannelBufferTools;
-import static org.traccar.helper.DecoderVerifier.verify;
public class CastelProtocolDecoderTest extends ProtocolDecoderTest {
@@ -14,35 +13,35 @@ public class CastelProtocolDecoderTest extends ProtocolDecoderTest {
CastelProtocolDecoder decoder = new CastelProtocolDecoder(new CastelProtocol());
- assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString(
- "4040450004323132474c31313433303035303033000000000040082ca89b55a6a99b555c57000000000000c40200000b0000001400036401111f000302f5533bd653f10d0a"))));
+ verifyNothing(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ "4040450004323132474c31313433303035303033000000000040082ca89b55a6a99b555c57000000000000c40200000b0000001400036401111f000302f5533bd653f10d0a"));
- assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString(
- "40404d0004323132474c3131343330303530303300000000004007120000002ca89b55cba99b555c57000000000000c40200000b0000000000036401111f000102000101170000000068850d0a"))));
+ verifyNothing(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ "40404d0004323132474c3131343330303530303300000000004007120000002ca89b55cba99b555c57000000000000c40200000b0000000000036401111f000102000101170000000068850d0a"));
- assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString(
- "4040420004323132474c31313433303035303033000000000010022ca89b55cca99b555c57000000000000cf0200000b0000000000036401111f0000020013be0d0a"))));
+ verifyNothing(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ "4040420004323132474c31313433303035303033000000000010022ca89b55cca99b555c57000000000000cf0200000b0000000000036401111f0000020013be0d0a"));
- assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString(
- "4040870004323132474c31313433303035303033000000000040052ca89b55e3a89b555c57000000000000c4020000040000001400036401111f0003000012042105210b210c210d210f211021112113211c2121212321242133213421422146214f212b50663603003ce9030dff060000600dffffc25865ffff9e02b43624000000003cbc0d0a"))));
+ verifyNothing(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ "4040870004323132474c31313433303035303033000000000040052ca89b55e3a89b555c57000000000000c4020000040000001400036401111f0003000012042105210b210c210d210f211021112113211c2121212321242133213421422146214f212b50663603003ce9030dff060000600dffffc25865ffff9e02b43624000000003cbc0d0a"));
- assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString(
- "4040d00004323132474c31313433303035303033000000000010013ec09b5596c29b555c57000000000000de0200000f0000000000036401111f000000004944445f3231334730325f532056322e322e36004944445f3231334730325f482056322e322e360032000110021003100410051006100710081009100a100b100c100d100e1011100111021103110411051106110711011202120312041201130213031301160216011701180218011b011c011d011e011f021f031f041f051f061f071f012102210126012701288a690d0a"))));
+ verifyNothing(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ "4040d00004323132474c31313433303035303033000000000010013ec09b5596c29b555c57000000000000de0200000f0000000000036401111f000000004944445f3231334730325f532056322e322e36004944445f3231334730325f482056322e322e360032000110021003100410051006100710081009100a100b100c100d100e1011100111021103110411051106110711011202120312041201130213031301160216011701180218011b011c011d011e011f021f031f041f051f061f071f012102210126012701288a690d0a"));
- assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString(
- "40404d0004323132474c3131343330303530303300000000004007050000003ec09b5564c29b555c57000000000000de0200000f0000002000036401111f0000020001010e00000000237e0d0a"))));
+ verifyNothing(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ "40404d0004323132474c3131343330303530303300000000004007050000003ec09b5564c29b555c57000000000000de0200000f0000002000036401111f0000020001010e00000000237e0d0a"));
- assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString(
- "40401F00043130303131313235323939383700000000000000100303320D0A"))));
+ verifyNothing(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ "40401F00043130303131313235323939383700000000000000100303320D0A"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString(
- "40407F000431303031313132353239393837000000000000001001C1F06952FDF069529C91110000000000698300000C0000000000036401014C00030001190A0D04121A1480D60488C5721800000000AF4944445F3231364730325F532056312E322E31004944445F3231364730325F482056312E322E31000000DF640D0A"))));
+ verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ "40407F000431303031313132353239393837000000000000001001C1F06952FDF069529C91110000000000698300000C0000000000036401014C00030001190A0D04121A1480D60488C5721800000000AF4944445F3231364730325F532056312E322E31004944445F3231364730325F482056312E322E31000000DF640D0A"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString(
- "40405900043130303131313235323939383700000000000000400101C1F06952E7F069529C9111000000000069830000070000000400036401014C00030001190A0D0412041480D60488C57218000000009F01E803ED9A0D0A"))));
+ verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ "40405900043130303131313235323939383700000000000000400101C1F06952E7F069529C9111000000000069830000070000000400036401014C00030001190A0D0412041480D60488C57218000000009F01E803ED9A0D0A"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString(
- "40405900043335343034333035303834343134330000000000400100f61a7355c11b7355710000000b00000000000000000000000400000000240e0200020106060f100b2d5a78a7076ec0fb1d00008c065f010000ac220d0a"))));
+ verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ "40405900043335343034333035303834343134330000000000400100f61a7355c11b7355710000000b00000000000000000000000400000000240e0200020106060f100b2d5a78a7076ec0fb1d00008c065f010000ac220d0a"));
}
diff --git a/test/org/traccar/protocol/CellocatorProtocolDecoderTest.java b/test/org/traccar/protocol/CellocatorProtocolDecoderTest.java
index d744a55ee..e90d185d0 100644
--- a/test/org/traccar/protocol/CellocatorProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/CellocatorProtocolDecoderTest.java
@@ -2,8 +2,8 @@ package org.traccar.protocol;
import java.nio.ByteOrder;
import org.jboss.netty.buffer.ChannelBuffers;
-import static org.traccar.helper.DecoderVerifier.verify;
import org.junit.Test;
+import org.traccar.ProtocolDecoderTest;
import org.traccar.helper.ChannelBufferTools;
public class CellocatorProtocolDecoderTest extends ProtocolDecoderTest {
@@ -13,14 +13,14 @@ public class CellocatorProtocolDecoderTest extends ProtocolDecoderTest {
CellocatorProtocolDecoder decoder = new CellocatorProtocolDecoder(new CellocatorProtocol());
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString(
- "4D4347500006000000081A02021204000000210062300000006B00E100000000000000000000E5A100040206614EA303181A57034E1200000000000000001525071403D60749"))));
+ verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ "4D4347500006000000081A02021204000000210062300000006B00E100000000000000000000E5A100040206614EA303181A57034E1200000000000000001525071403D60749"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString(
- "4d434750000101000008011f041804000000200100000000005e750000000000000000000000548500040204da4da30367195703e80300000000000000002014151007dd07f7"))));
+ verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ "4d434750000101000008011f041804000000200100000000005e750000000000000000000000548500040204da4da30367195703e80300000000000000002014151007dd07f7"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString(
- "4d434750005e930100080102041804000000200f20000000005e7500000000000000000000005af400040204da4da30367195703e8030000000000000000021a111e08dd0760"))));
+ verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ "4d434750005e930100080102041804000000200f20000000005e7500000000000000000000005af400040204da4da30367195703e8030000000000000000021a111e08dd0760"));
}
diff --git a/test/org/traccar/protocol/CityeasyProtocolDecoderTest.java b/test/org/traccar/protocol/CityeasyProtocolDecoderTest.java
index 487d20d4e..33ee51c4f 100644
--- a/test/org/traccar/protocol/CityeasyProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/CityeasyProtocolDecoderTest.java
@@ -2,10 +2,9 @@ package org.traccar.protocol;
import org.jboss.netty.buffer.ChannelBuffers;
import org.junit.Test;
+import org.traccar.ProtocolDecoderTest;
import org.traccar.helper.ChannelBufferTools;
-import static org.junit.Assert.assertNull;
-import static org.traccar.helper.DecoderVerifier.verify;
public class CityeasyProtocolDecoderTest extends ProtocolDecoderTest {
@@ -14,20 +13,20 @@ public class CityeasyProtocolDecoderTest extends ProtocolDecoderTest {
CityeasyProtocolDecoder decoder = new CityeasyProtocolDecoder(new CityeasyProtocol());
- assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "545400153520000000000100010000000111000D0A"))));
+ verifyNothing(decoder, binary(
+ "545400153520000000000100010000000111000D0A"));
- assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "54540019357557024902000002520704300000000376390d0a"))));
+ verifyNothing(decoder, binary(
+ "54540019357557024902000002520704300000000376390d0a"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "5454006135200000000001000332303134313131303039353430392C412C342C4E2C32322E3533373232382C452C3131342E3032323737342C302E312C312E392C35302E363B3436302C302C31303137332C343635322C34310000000B63130D0A"))));
+ verifyPosition(decoder, binary(
+ "5454006135200000000001000332303134313131303039353430392C412C342C4E2C32322E3533373232382C452C3131342E3032323737342C302E312C312E392C35302E363B3436302C302C31303137332C343635322C34310000000B63130D0A"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "5454006135200000000001000432303134313131303039353330362C412C352C4E2C32322E3533373233352C452C3131342E3032323838312C302E322C312E362C35342E313B3436302C302C31303137332C343635322C343100000045EC620D0A"))));
+ verifyPosition(decoder, binary(
+ "5454006135200000000001000432303134313131303039353330362C412C352C4E2C32322E3533373233352C452C3131342E3032323838312C302E322C312E362C35342E313B3436302C302C31303137332C343635322C343100000045EC620D0A"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "5454009035755702490200000332303135303732393033303834352c412c362c4e2c31322e3833353735362c452c37372e3638373039362c302e332c312e322c3931302e303b3430342c34352c31303638312c31313632312c34332c31303638312c31313632332c32312c31303638312c32323538332c32302c31303638312c32333338312c31380000000267370d0a"))));
+ verifyPosition(decoder, binary(
+ "5454009035755702490200000332303135303732393033303834352c412c362c4e2c31322e3833353735362c452c37372e3638373039362c302e332c312e322c3931302e303b3430342c34352c31303638312c31313632312c34332c31303638312c31313632332c32312c31303638312c32323538332c32302c31303638312c32333338312c31380000000267370d0a"));
}
diff --git a/test/org/traccar/protocol/EasyTrackProtocolDecoderTest.java b/test/org/traccar/protocol/EasyTrackProtocolDecoderTest.java
index 37dcdec59..9e1dfce34 100644
--- a/test/org/traccar/protocol/EasyTrackProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/EasyTrackProtocolDecoderTest.java
@@ -1,8 +1,7 @@
package org.traccar.protocol;
-import static org.traccar.helper.DecoderVerifier.verify;
-import static org.junit.Assert.assertNull;
import org.junit.Test;
+import org.traccar.ProtocolDecoderTest;
public class EasyTrackProtocolDecoderTest extends ProtocolDecoderTest {
@@ -11,27 +10,28 @@ public class EasyTrackProtocolDecoderTest extends ProtocolDecoderTest {
EasyTrackProtocolDecoder decoder = new EasyTrackProtocolDecoder(new EasyTrackProtocol());
- assertNull(decoder.decode(null, null, "*ET,135790246811221,GZ,0001,0005"));
+ verifyNothing(decoder, text(
+ "*ET,135790246811221,GZ,0001,0005"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"*ET,135790246811221,DW,A,0A090D,101C0D,00CF27C6,0413FA4E,0000,0000,00000000,20,4,0000,00F123"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"*ET,135790246811221,DW,A,050915,0C2A27,00CE5954,04132263,0000,0000,01000000,20,4,0000,001254"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"*ET,135790246811221,DW,A,0A090D,101C0D,00CF27C6,0413FA4E,0000,0000,00000000,20,4,0000,00F123,100"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"*ET,135790246811221,DW,A,0A090D,101C0D,00CF27C6,8413FA4E,0000,0000,00000000,20,4,0000,00F123,100"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"*ET,358155100003016,HB,A,0d081e,07381e,8038ee09,03d2e9be,004f,0000,40c00000,0f,100,0000,00037c,29"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"*ET,358155100003016,HB,A,0d081e,073900,8038ee2f,03d2e9fd,0114,0000,40c00000,12,100,0000,00037c,32"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"*ET,135790246811221,HB,A,050915,0C2A27,00CE5954,04132263,0000,0000,01000000,20,4,0000,00F123,100,200"));
}
diff --git a/test/org/traccar/protocol/EelinkProtocolDecoderTest.java b/test/org/traccar/protocol/EelinkProtocolDecoderTest.java
index c736f33a4..2af9d2453 100644
--- a/test/org/traccar/protocol/EelinkProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/EelinkProtocolDecoderTest.java
@@ -1,10 +1,9 @@
package org.traccar.protocol;
import org.jboss.netty.buffer.ChannelBuffers;
-import static org.junit.Assert.assertNull;
import org.junit.Test;
+import org.traccar.ProtocolDecoderTest;
import org.traccar.helper.ChannelBufferTools;
-import static org.traccar.helper.DecoderVerifier.verify;
public class EelinkProtocolDecoderTest extends ProtocolDecoderTest {
@@ -13,20 +12,20 @@ public class EelinkProtocolDecoderTest extends ProtocolDecoderTest {
EelinkProtocolDecoder decoder = new EelinkProtocolDecoder(new EelinkProtocol());
- assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "676701000c002603541880486128290120"))));
+ verifyNothing(decoder, binary(
+ "676701000c002603541880486128290120"));
- assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "676701000b001b035418804661834901"))));
+ verifyNothing(decoder, binary(
+ "676701000b001b035418804661834901"));
- assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "6767030004001A0001"))));
+ verifyNothing(decoder, binary(
+ "6767030004001A0001"));
- assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "6767070088001050E2281400FFFFFFFF02334455660333445566043344556605AA00000007334455660A334455660B334455660C4E2000000DAA0000000E334455660F3344556610AAAA000011334455661C334455661F334455662133445566423344556646334455664D334455665C334455665E33445566880000000089000000008A000000008B00000000"))));
+ verifyNothing(decoder, binary(
+ "6767070088001050E2281400FFFFFFFF02334455660333445566043344556605AA00000007334455660A334455660B334455660C4E2000000DAA0000000E334455660F3344556610AAAA000011334455661C334455661F334455662133445566423344556646334455664D334455665C334455665E33445566880000000089000000008A000000008B00000000"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "676702001b03c5538086df0190c1790b3482df0f0157020800013beb00342401"))));
+ verifyPosition(decoder, binary(
+ "676702001b03c5538086df0190c1790b3482df0f0157020800013beb00342401"));
}
diff --git a/test/org/traccar/protocol/EnforaProtocolDecoderTest.java b/test/org/traccar/protocol/EnforaProtocolDecoderTest.java
index 2dd649cbd..ac5191b62 100644
--- a/test/org/traccar/protocol/EnforaProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/EnforaProtocolDecoderTest.java
@@ -2,10 +2,9 @@ package org.traccar.protocol;
import org.jboss.netty.buffer.ChannelBuffers;
-import static org.junit.Assert.assertNull;
import org.junit.Test;
+import org.traccar.ProtocolDecoderTest;
import org.traccar.helper.ChannelBufferTools;
-import static org.traccar.helper.DecoderVerifier.verify;
public class EnforaProtocolDecoderTest extends ProtocolDecoderTest {
@@ -14,20 +13,20 @@ public class EnforaProtocolDecoderTest extends ProtocolDecoderTest {
EnforaProtocolDecoder decoder = new EnforaProtocolDecoder(new EnforaProtocol());
- assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "000A08002020202020303131303730303030353730323637"))));
+ verifyNothing(decoder, binary(
+ "000A08002020202020303131303730303030353730323637"));
- assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "003B000502000000000820202020202030313130373030303035373032363720383A000000000D00508401358E640032B37700000367B00000A804"))));
+ verifyNothing(decoder, binary(
+ "003B000502000000000820202020202030313130373030303035373032363720383A000000000D00508401358E640032B37700000367B00000A804"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "007100040200202020202020202020382020202020202031323334353637383930313233343520313320244750524D432C3232333135322E30302C412C333530392E3836303539342C4E2C30333332322E3734333838372C452C302E302C302E302C3032303631322C2C2C412A35320D0A"))));
+ verifyPosition(decoder, binary(
+ "007100040200202020202020202020382020202020202031323334353637383930313233343520313320244750524D432C3232333135322E30302C412C333530392E3836303539342C4E2C30333332322E3734333838372C452C302E302C302E302C3032303631322C2C2C412A35320D0A"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "007600040200202020202020202020382020202020202030313138393230303036303831383920313320244750524D432C3137313834312E30302C412C333530392E3835323431302C4E2C30333332322E3735393131332C452C302E302C302E302C3137303731322C332E342C572C412A32350D0A00"))));
+ verifyPosition(decoder, binary(
+ "007600040200202020202020202020382020202020202030313138393230303036303831383920313320244750524D432C3137313834312E30302C412C333530392E3835323431302C4E2C30333332322E3735393131332C452C302E302C302E302C3137303731322C332E342C572C412A32350D0A00"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "006a000a081000202020202020202020333320202020202038363130373430323137313936353620204750524d432c3136313234382e30302c412c333433322e36393231312c532c30353833312e30323231372c572c302e3034382c2c3232303831342c2c2c412a3734"))));
+ verifyPosition(decoder, binary(
+ "006a000a081000202020202020202020333320202020202038363130373430323137313936353620204750524d432c3136313234382e30302c412c333433322e36393231312c532c30353833312e30323231372c572c302e3034382c2c3232303831342c2c2c412a3734"));
}
diff --git a/test/org/traccar/protocol/Ev603ProtocolDecoderTest.java b/test/org/traccar/protocol/Ev603ProtocolDecoderTest.java
index 8a2b6c1f5..a843fcf21 100644
--- a/test/org/traccar/protocol/Ev603ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/Ev603ProtocolDecoderTest.java
@@ -1,8 +1,7 @@
package org.traccar.protocol;
-import static org.traccar.helper.DecoderVerifier.verify;
-import static org.junit.Assert.assertNull;
import org.junit.Test;
+import org.traccar.ProtocolDecoderTest;
public class Ev603ProtocolDecoderTest extends ProtocolDecoderTest {
@@ -11,25 +10,28 @@ public class Ev603ProtocolDecoderTest extends ProtocolDecoderTest {
Ev603ProtocolDecoder decoder = new Ev603ProtocolDecoder(new Ev603Protocol());
- assertNull(decoder.decode(null, null, "!1,123456789012345"));
+ verifyNothing(decoder, text(
+ "!1,123456789012345"));
- assertNull(decoder.decode(null, null, "!5,17,V"));
+ verifyNothing(decoder, text(
+ "!5,17,V"));
- assertNull(decoder.decode(null, null, "!1,860719027585011"));
+ verifyNothing(decoder, text(
+ "!1,860719027585011"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"!A,26/10/12,00:28:41,7.770385,-72.215706,0.0,25101,0"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"!A,01/12/10,13:25:35,22.641724,114.023666,000.1,281.6,0"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"!D,08/07/15,04:01:32,40.428257,-3.704808,0,0,170001,701.7,22,5,14,0"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"!D,08/07/15,04:55:13,40.428257,-3.704932,0,0,180001,680.0,8,8,13,0"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"!D,08/07/15,02:01:32,40.428230,-3.704950,4,170,170001,682.7,43,6,13,0"));
}
diff --git a/test/org/traccar/protocol/FlextrackProtocolDecoderTest.java b/test/org/traccar/protocol/FlextrackProtocolDecoderTest.java
index 6b22f2906..049b0e95e 100644
--- a/test/org/traccar/protocol/FlextrackProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/FlextrackProtocolDecoderTest.java
@@ -1,9 +1,8 @@
package org.traccar.protocol;
import org.junit.Test;
+import org.traccar.ProtocolDecoderTest;
-import static org.junit.Assert.assertNull;
-import static org.traccar.helper.DecoderVerifier.verify;
public class FlextrackProtocolDecoderTest extends ProtocolDecoderTest {
@@ -12,16 +11,16 @@ public class FlextrackProtocolDecoderTest extends ProtocolDecoderTest {
FlextrackProtocolDecoder decoder = new FlextrackProtocolDecoder(new FlextrackProtocol());
- assertNull(decoder.decode(null, null,
+ verifyNothing(decoder, text(
"-1,LOGON,7000000123,8945000000"));
- assertNull(decoder.decode(null, null,
+ verifyNothing(decoder, text(
"-1,LOGON,1080424008,8945020110126633198"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"-2,UNITSTAT,20060101,123442,1080424008,N0.00.0000,E0.00.0000,0,0,0,4129,-61,2,23866,0,999,A214,63,2EE2,3471676"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"-2,UNITSTAT,20050205,181923,7000004634,N55.46.0812,E009.21.1665,122,198,6,3934,-81,01A8,23802,213,55,37FD,45,0055,12878"));
}
diff --git a/test/org/traccar/protocol/FreedomProtocolDecoderTest.java b/test/org/traccar/protocol/FreedomProtocolDecoderTest.java
index d8975e861..521fe20ab 100644
--- a/test/org/traccar/protocol/FreedomProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/FreedomProtocolDecoderTest.java
@@ -1,8 +1,7 @@
package org.traccar.protocol;
-import static org.traccar.helper.DecoderVerifier.verify;
-
import org.junit.Test;
+import org.traccar.ProtocolDecoderTest;
public class FreedomProtocolDecoderTest extends ProtocolDecoderTest {
@@ -11,7 +10,7 @@ public class FreedomProtocolDecoderTest extends ProtocolDecoderTest {
FreedomProtocolDecoder decoder = new FreedomProtocolDecoder(new FreedomProtocol());
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"IMEI,353358011714362,2014/05/22, 20:49:32, N, Lat:4725.9624, E, Lon:01912.5483, Spd:5.05"));
}
diff --git a/test/org/traccar/protocol/GalileoProtocolDecoderTest.java b/test/org/traccar/protocol/GalileoProtocolDecoderTest.java
index 18fc48d3e..c57e70ee9 100644
--- a/test/org/traccar/protocol/GalileoProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/GalileoProtocolDecoderTest.java
@@ -2,10 +2,9 @@ package org.traccar.protocol;
import java.nio.ByteOrder;
import org.jboss.netty.buffer.ChannelBuffers;
-import static org.junit.Assert.assertNull;
import org.junit.Test;
+import org.traccar.ProtocolDecoderTest;
import org.traccar.helper.ChannelBufferTools;
-import static org.traccar.helper.DecoderVerifier.verify;
public class GalileoProtocolDecoderTest extends ProtocolDecoderTest {
@@ -14,14 +13,14 @@ public class GalileoProtocolDecoderTest extends ProtocolDecoderTest {
GalileoProtocolDecoder decoder = new GalileoProtocolDecoder(new GalileoProtocol());
- assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString(
- "011380033836383230343030313534393038370432008590"))));
+ verifyNothing(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ "011380033836383230343030313534393038370432008590"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString(
- "01cf030446ba10630320a7054c533008f86c8e0310062c043347049e02344000350940013241506b428f10432244aeea572045f9004604a0500000510000529a6b5300000446ba10712420ce1c4b533009b4f06703043df4033381037b0a343800350a40093241db6b428f10432544c05ef81f45f9004604a050000051000052886b5300000446ba10702420c11c4b53300a54f16703c450f403336e034e0a343900350840093241dd6b428f1043254491eaf71f45f9004604a050000051000052c26b5300000446ba106f2420b31c4b53300cecf267033865f403336a03300a343800350740093241e66b429010432544b446582045f9004604a050000051000052f76b5300000446ba106e2420a61c4b53300c9cf467038878f403337b03370a343800350740093241b56b428f10432544ba46f81f45f9004604a050000051000052c66b5300000446ba106d2420991c4b53300bc8f56703508cf403338d036e0a343700350840093241d66b428f10432544b4ea572045f9004604a050000051000052846b5300000446ba106c24208c1c4b533008c8f5670370a0f403338703920a343a00350e40093241c76b428f10432544c0fef71f45f9004604a0500000510000528d6b5300000446ba106b24207f1c4b533009a4f5670338b4f403337603920a343c00350a40093241d06b428f104325449146a81f45f9004604a0500000510000528a6b5300000446ba106a2420721c4b53300b9cf56703ecc7f403337103810a343a00350840093241ca6b428f10432544d12e582045f9004604a050000051000052996b5300000446ba10692420651c4b53300a64f6670358dbf403337a03490a343900350840093241e56b429010432544aed2f71f45f9004604a050000051000052b26b5300000446ba10682420581c4b5330094cf86703e0eef4033381030c0a343a00350940093241f96b428f10432544cb2e182145f9004604a050000051000052926b5300000446ba106724204b1c4b533009f8fa67032802f503337b03fc09343b00350a40093241d86b428f10432544c0ea772145f9004604a0500000510000529e6b5300000446ba106624203e1c4b533009a0fd67036815f503338403fd09343c00350a40093241a86b428f10432544ae2e582045f9004604a050000051000052a86b5300000446ba10652420311c4b53300944006803b028f503338003ff09343d00350940093241dc6b428e10432544a8fea71f45f9004604a050000051000052e26b5300000446ba10642420241c4b533008f0026803083cf503338b03f909343c00350d40093241d36b428f10432544c0eaa71f45f9004604a050000051000052ab6b530000ff3f"))));
+ verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ "01cf030446ba10630320a7054c533008f86c8e0310062c043347049e02344000350940013241506b428f10432244aeea572045f9004604a0500000510000529a6b5300000446ba10712420ce1c4b533009b4f06703043df4033381037b0a343800350a40093241db6b428f10432544c05ef81f45f9004604a050000051000052886b5300000446ba10702420c11c4b53300a54f16703c450f403336e034e0a343900350840093241dd6b428f1043254491eaf71f45f9004604a050000051000052c26b5300000446ba106f2420b31c4b53300cecf267033865f403336a03300a343800350740093241e66b429010432544b446582045f9004604a050000051000052f76b5300000446ba106e2420a61c4b53300c9cf467038878f403337b03370a343800350740093241b56b428f10432544ba46f81f45f9004604a050000051000052c66b5300000446ba106d2420991c4b53300bc8f56703508cf403338d036e0a343700350840093241d66b428f10432544b4ea572045f9004604a050000051000052846b5300000446ba106c24208c1c4b533008c8f5670370a0f403338703920a343a00350e40093241c76b428f10432544c0fef71f45f9004604a0500000510000528d6b5300000446ba106b24207f1c4b533009a4f5670338b4f403337603920a343c00350a40093241d06b428f104325449146a81f45f9004604a0500000510000528a6b5300000446ba106a2420721c4b53300b9cf56703ecc7f403337103810a343a00350840093241ca6b428f10432544d12e582045f9004604a050000051000052996b5300000446ba10692420651c4b53300a64f6670358dbf403337a03490a343900350840093241e56b429010432544aed2f71f45f9004604a050000051000052b26b5300000446ba10682420581c4b5330094cf86703e0eef4033381030c0a343a00350940093241f96b428f10432544cb2e182145f9004604a050000051000052926b5300000446ba106724204b1c4b533009f8fa67032802f503337b03fc09343b00350a40093241d86b428f10432544c0ea772145f9004604a0500000510000529e6b5300000446ba106624203e1c4b533009a0fd67036815f503338403fd09343c00350a40093241a86b428f10432544ae2e582045f9004604a050000051000052a86b5300000446ba10652420311c4b53300944006803b028f503338003ff09343d00350940093241dc6b428e10432544a8fea71f45f9004604a050000051000052e26b5300000446ba10642420241c4b533008f0026803083cf503338b03f909343c00350d40093241d36b428f10432544c0eaa71f45f9004604a050000051000052ab6b530000ff3f"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString(
- "011e8304320010270220dbd2f051300a90cf740328ac59033300000000347600351240012a41e92e42500f431f440006c814450f00460020500000510000520000530000540000550000560000570000580000600000610000620000a000a100a200a300a400a500a600a700a800a900aa00ab00ac00ad00ae00af00b00000b10000b20000b30000b40000b50000b60000b70000b80000b90000c000000000c100000000c200000000c300000000c400c500c600c700c800c900ca00cb00cc00cd00ce00cf00d000d100d200d471020000d60000d70000d80000d90000da0000db00000000dc00000000dd00000000de00000000df00000000f000000000f100000000f200000000f30000000004320010260220bdd2f051300590cf740328ac59033300000000347600351440090a41f02e427b0f431f44ff0db814450f00460000500000510000520000530000540000550000560000570000580000600000610000620000a000a100a200a300a400a500a600a700a800a900aa00ab00ac00ad00ae00af00b00000b10000b20000b30000b40000b50000b60000b70000b80000b90000c000000000c100000000c200000000c300000000c400c500c600c700c800c900ca00cb00cc00cd00ce00cf00d000d100d200d471020000d60000d70000d80000d90000da0000db00000000dc00000000dd00000000de00000000df00000000f000000000f100000000f200000000f300000000043200102502208ed2f051300ed8d0740304ac5903330000000034a500350a40012a41ec2e422d0f431f440016b814450f00460020500000510000520000530000540000550000560000570000580000600000610000620000a000a100a200a300a400a500a600a700a800a900aa00ab00ac00ad00ae00af00b00000b10000b20000b30000b40000b50000b60000b70000b80000b90000c000000000c100000000c200000000c300000000c400c500c600c700c800c900ca00cb00cc00cd00ce00cf00d000d100d200d44d020000d60000d70000d80000d90000da0000db00000000dc00000000dd00000000de00000000df00000000f000000000f100000000f200000000f300000000622e"))));
+ verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ "011e8304320010270220dbd2f051300a90cf740328ac59033300000000347600351240012a41e92e42500f431f440006c814450f00460020500000510000520000530000540000550000560000570000580000600000610000620000a000a100a200a300a400a500a600a700a800a900aa00ab00ac00ad00ae00af00b00000b10000b20000b30000b40000b50000b60000b70000b80000b90000c000000000c100000000c200000000c300000000c400c500c600c700c800c900ca00cb00cc00cd00ce00cf00d000d100d200d471020000d60000d70000d80000d90000da0000db00000000dc00000000dd00000000de00000000df00000000f000000000f100000000f200000000f30000000004320010260220bdd2f051300590cf740328ac59033300000000347600351440090a41f02e427b0f431f44ff0db814450f00460000500000510000520000530000540000550000560000570000580000600000610000620000a000a100a200a300a400a500a600a700a800a900aa00ab00ac00ad00ae00af00b00000b10000b20000b30000b40000b50000b60000b70000b80000b90000c000000000c100000000c200000000c300000000c400c500c600c700c800c900ca00cb00cc00cd00ce00cf00d000d100d200d471020000d60000d70000d80000d90000da0000db00000000dc00000000dd00000000de00000000df00000000f000000000f100000000f200000000f300000000043200102502208ed2f051300ed8d0740304ac5903330000000034a500350a40012a41ec2e422d0f431f440016b814450f00460020500000510000520000530000540000550000560000570000580000600000610000620000a000a100a200a300a400a500a600a700a800a900aa00ab00ac00ad00ae00af00b00000b10000b20000b30000b40000b50000b60000b70000b80000b90000c000000000c100000000c200000000c300000000c400c500c600c700c800c900ca00cb00cc00cd00ce00cf00d000d100d200d44d020000d60000d70000d80000d90000da0000db00000000dc00000000dd00000000de00000000df00000000f000000000f100000000f200000000f300000000622e"));
}
diff --git a/test/org/traccar/protocol/GatorProtocolDecoderTest.java b/test/org/traccar/protocol/GatorProtocolDecoderTest.java
index 606f58942..6460e82de 100644
--- a/test/org/traccar/protocol/GatorProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/GatorProtocolDecoderTest.java
@@ -3,8 +3,8 @@ package org.traccar.protocol;
import org.jboss.netty.buffer.ChannelBuffers;
import org.junit.Assert;
import org.junit.Test;
+import org.traccar.ProtocolDecoderTest;
import org.traccar.helper.ChannelBufferTools;
-import static org.traccar.helper.DecoderVerifier.verify;
public class GatorProtocolDecoderTest extends ProtocolDecoderTest {
@@ -20,17 +20,17 @@ public class GatorProtocolDecoderTest extends ProtocolDecoderTest {
GatorProtocolDecoder decoder = new GatorProtocolDecoder(new GatorProtocol());
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "24248000260009632d141121072702059226180104367500000000c04700079c0c34000ad80b00ff000a0d"))));
+ verifyPosition(decoder, binary(
+ "24248000260009632d141121072702059226180104367500000000c04700079c0c34000ad80b00ff000a0d"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "24248100230CA23285100306145907022346901135294700000000C04001012C0E1100000021CB0D"))));
+ verifyPosition(decoder, binary(
+ "24248100230CA23285100306145907022346901135294700000000C04001012C0E1100000021CB0D"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "2424800023c2631e00111220104909833268648703804100000000c0470000000b4e00000000550d"))));
+ verifyPosition(decoder, binary(
+ "2424800023c2631e00111220104909833268648703804100000000c0470000000b4e00000000550d"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "24248000260009632d141121072702059226180104367500000000c04700079c0c34000ad80b00ff000a0d"))));
+ verifyPosition(decoder, binary(
+ "24248000260009632d141121072702059226180104367500000000c04700079c0c34000ad80b00ff000a0d"));
}
diff --git a/test/org/traccar/protocol/Gl100ProtocolDecoderTest.java b/test/org/traccar/protocol/Gl100ProtocolDecoderTest.java
index 0755fea5a..52c331f13 100644
--- a/test/org/traccar/protocol/Gl100ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/Gl100ProtocolDecoderTest.java
@@ -1,8 +1,8 @@
package org.traccar.protocol;
-import static org.junit.Assert.assertNull;
-import static org.traccar.helper.DecoderVerifier.verify;
+
import org.junit.Test;
+import org.traccar.ProtocolDecoderTest;
public class Gl100ProtocolDecoderTest extends ProtocolDecoderTest {
@@ -11,31 +11,31 @@ public class Gl100ProtocolDecoderTest extends ProtocolDecoderTest {
Gl100ProtocolDecoder decoder = new Gl100ProtocolDecoder(new Gl100Protocol());
- assertNull(decoder.decode(null, null,
+ verifyNothing(decoder, text(
"AT+GTHBD=HeartBeat,359231030000010,20090101000000,11F0,0102120204"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"+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"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"+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"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"+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"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"+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"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"+RESP:GTLBC,359231030000010,02132523415,1,4.3,92,70.0,1,121.354335,31.222073,20090101000000,0460,0000,18d8,6141,00,11F0,0102120204"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"+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"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"+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"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"+RESP:GTTRI,359464030073766,1,0,0,0,1.7,254,-27.8,3,30.474475,50.488383,20131107155511,0255,0003,6995,4761,00,0071,0103090402"));
}
diff --git a/test/org/traccar/protocol/Gl200ProtocolDecoderTest.java b/test/org/traccar/protocol/Gl200ProtocolDecoderTest.java
index 2cbda8b7f..9a124143d 100644
--- a/test/org/traccar/protocol/Gl200ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/Gl200ProtocolDecoderTest.java
@@ -1,8 +1,7 @@
package org.traccar.protocol;
-import static org.junit.Assert.assertNull;
import org.junit.Test;
-import static org.traccar.helper.DecoderVerifier.verify;
+import org.traccar.ProtocolDecoderTest;
public class Gl200ProtocolDecoderTest extends ProtocolDecoderTest {
@@ -11,130 +10,130 @@ public class Gl200ProtocolDecoderTest extends ProtocolDecoderTest {
Gl200ProtocolDecoder decoder = new Gl200ProtocolDecoder(new Gl200Protocol());
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"+RESP:GTFRI,0F0106,862193020451183,,,10,1,1,0.0,163,,-57.513617,-25.368191,20150918182145,,,,,,21235.0,,,,0,210100,,,,20150918182149,00B8$"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"+RESP:GTOBD,1F0109,864251020135483,,gv500,0,78FFFF,,1,12613,,,,,,,,,,,,,,1286,0,0.0,0,17.1,3.379630,6.529701,20150813074639,0621,0030,51C0,A2B3,00,0.0,20150813074641,A7E6$"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"+RESP:GTOBD,1F0109,864251020135483,4T1BE46KX7U018210,gv500,0,78FFFF,4T1BE46KX7U018210,1,13411,981B81C0,787,3,43,,921,463,1,10,0300030103030304001200310351035203530354,20,55,,1286,0,6.5,74,21.6,3.379710,6.529714,20150813074824,0621,0030,51C0,A2B3,00,0.0,20150813074828,A7E9$"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"+RESP:GTSTT,1A0401,860599000508846,,41,0,0.0,84,107.5,-76.657998,39.497203,20150623160622,0310,0260,B435,3B81,,20150623160622,0F54$"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"+RESP:GTFRI,1A0401,860599000508846,,0,0,1,1,134.8,154,278.7,-76.671089,39.778885,20150623154301,0310,0260,043F,7761,,99,20150623154314,0F24$"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"+RESP:GTFRI,1A0200,860599000165464,CRI001,0,0,1,2,,41,,-71.153137,42.301634,20150328020301,,,,,280.3,55,20150327220351,320C"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"+RESP:GTFRI,02010D,867844001675407,,0,0,1,2,0.0,0,28.9,8.591011,56.476397,20140915213209,0238,0001,03CB,2871,,97,20140915213459,009A"));
- assertNull(decoder.decode(null, null,
+ verifyNothing(decoder, text(
"+RESP:GTINF,359464030073766,8938003990320469804f,18,99,100,1,0,+2.00,0,20131018084015,00EE,0103090402"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"+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"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"+RESP:GTSTT,04040C,359231038939904,,42,0,0.0,117,346.0,8.924243,50.798077,20130618125152,0262,0002,0299,109C,00,20130618125154,017A"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"+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"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"+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"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"+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"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"+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"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"+RESP:GTLBC,020102,135790246811220,,+8613800000000,1,4.3,92,70.0,121.354335,31.222073,20090214013254,0460,0000,18d8,6141,00,,20090214093254,11F0"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"+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"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"+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"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"+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$"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"+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$"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"+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$"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"+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$"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"+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$"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"+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$"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"+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$"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"+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$"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"+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$"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"+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$"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"+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$"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"+RESP:GTFRI,02010C,867844001274144,,0,0,1,1,18.0,233,118.1,7.615551,51.515600,20140106130516,0262,0007,79E6,B956,,72,20140106140524,09CE$"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"+RESP:GTFRI,02010C,867844001274649,,0,0,1,1,0.0,0,122.5,7.684216,51.524512,20140106233722,0262,0007,79EE,1D22,,93,20140107003805,03C4$"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"+BUFF:GTFRI,210101,863286020016706,,,10,1,1,,,,49.903915,40.391669,20140818105815,,,,,,,,,,,210100,,,,,000C$"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"+RESP:GTFRI,240100,135790246811220,,,10,1,1,4.3,92,70.0,121.354335,31.222073,20090214013254,0460,0000,18d8,6141,00,2000.0,12345:12:34,,80,,,,,,20090214093254,11F0$"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"+RESP:GTFRI,240100,135790246811220,,,10,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,2000.0,12345:12:34,,,80,,,,,,20090214093254,11F0$"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"\u0000\u0004,005F,0,GTFRI,020100,135790246811220,,0,0,1,1,4.3,92,70.0,121.354335,31.222073,20090214013254,0460,0000,18d8,6141,90,20090214093254,11F0$"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"\u0000\u0004,005F,0,GTGEO,020100,135790246811220,,0,0,1,1,4.3,92,70.0,121.354335,31.222073,20090214013254,0460,0000,18d8,6141,90,20090214093254,11F0$"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"\u0000\u0004,005F,0,GTNMR,020100,135790246811220,,0,0,1,1,4.3,92,70.0,121.354335,31.222073,20090214013254,0460,0000,18d8,6141,90,20090214093254,11F0$"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"\u0000\u0004,0017,0,GTNMR,,867844000400914,,0,41,1,2,0.0,0,1504.2,-75.569202,6.242850,20150404162835,,,,,97,20150404162836,05EF$"));
-
- assertNull(decoder.decode(null, null,
+
+ verifyNothing(decoder, text(
"\u0000\u0004,0017,0,GTPNA,,867844000400914,,0,0,1,0,,,,0,0,,,,,,99,20150404190153,0601$"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"\u0000\u0004,0017,0,GTEPN,,867844000400914,,0,0,1,0,0.0,0,1717.4,-75.598445,6.278578,20150405003116,,,,,95,20150405003358,0607$"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"+RESP:GTSTT,280100,A1000043D20139,,42,0,0.1,321,228.6,-76.660884,39.832552,20150615120628,0310,0484,00600019,0A52,,20150615085741,0320$"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"+RESP:GTRTL,280100,A1000043D20139,,0,0,1,1,0.1,321,239.1,-76.661047,39.832501,20150615114455,0310,0484,00600019,0A52,,87,20150615074456,031E$"));
- assertNull(decoder.decode(null, null,
+ verifyNothing(decoder, text(
"+ACK:GTHBD,1A0401,135790246811220,,20100214093254,11F0"));
}
diff --git a/test/org/traccar/protocol/GlobalSatProtocolDecoderTest.java b/test/org/traccar/protocol/GlobalSatProtocolDecoderTest.java
index 08e4cd77d..97b9f4aaa 100644
--- a/test/org/traccar/protocol/GlobalSatProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/GlobalSatProtocolDecoderTest.java
@@ -1,8 +1,7 @@
package org.traccar.protocol;
-import static org.junit.Assert.assertNull;
import org.junit.Test;
-import static org.traccar.helper.DecoderVerifier.verify;
+import org.traccar.ProtocolDecoderTest;
public class GlobalSatProtocolDecoderTest extends ProtocolDecoderTest {
@@ -11,39 +10,40 @@ public class GlobalSatProtocolDecoderTest extends ProtocolDecoderTest {
GlobalSatProtocolDecoder decoder = new GlobalSatProtocolDecoder(new GlobalSatProtocol());
- assertNull(decoder.decode(null, null, "GSh,131826789036289,3,M,ea04*3d"));
+ verifyNothing(decoder, text(
+ "GSh,131826789036289,3,M,ea04*3d"));
decoder.setFormat0("SORPZAB27GHKLMN*U!");
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"GSr,011412001878820,4,5,00,,1,250114,105316,E00610.2925,N4612.1824,0,0.02,0,1,0.0,64*51!"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"GSr,357938020310710,,4,04,,1,170315,060657,E00000.0000,N0000.0000,148,0.00,0,0,0.0,11991mV*6c!"));
decoder.setFormat0("TSPRXAB27GHKLMnaicz*U!");
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"GSr,1,135785412249986,01,I,EA02,3,230410,153318,E12129.2839,N2459.8570,0,1.17,212,8,1.0,12.3V*55"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"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"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"$355632004245866,1,1,040202,093633,E12129.2252,N2459.8891,00161,0.0100,147,07,2.4"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"$355632000959420,9,3,160413,230536,E03738.4906,N5546.3148,00000,0.3870,147,07,2.4"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"$353681041893264,9,3,240913,100833,E08513.0122,N5232.9395,181.3,22.02,251.30,9,1.00"));
- /*verify(decoder.decode(null, null,
+ /*verifyPosition(decoder, text(
"$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\""));*/
decoder.setFormat0("SPRXYAB27GHKLMmnaefghiotuvwb*U!");
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"GSr,GTR-128,013227006963064,0080,1,a080,3,190615,163816,W07407.7134,N0440.8601,2579,0.01,130,12,0.7,11540mV,0,77,14,\"732,123,0744,2fc1,41,23\",\"732,123,0744,2dfe,05,28\",\"732,123,0744,272a,15,21\",\"732,123,0744,2f02,27,23\"*3b!"));
}
diff --git a/test/org/traccar/protocol/GoSafeProtocolDecoderTest.java b/test/org/traccar/protocol/GoSafeProtocolDecoderTest.java
index 2adf92ee4..d5e2213c4 100644
--- a/test/org/traccar/protocol/GoSafeProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/GoSafeProtocolDecoderTest.java
@@ -1,8 +1,7 @@
package org.traccar.protocol;
-import static org.junit.Assert.assertNull;
import org.junit.Test;
-import static org.traccar.helper.DecoderVerifier.verify;
+import org.traccar.ProtocolDecoderTest;
public class GoSafeProtocolDecoderTest extends ProtocolDecoderTest {
@@ -11,19 +10,19 @@ public class GoSafeProtocolDecoderTest extends ProtocolDecoderTest {
GoSafeProtocolDecoder decoder = new GoSafeProtocolDecoder(new GoSafeProtocol());
- assertNull(decoder.decode(null, null,
+ verifyNothing(decoder, text(
"*GS16,351535058709775"));
- verify(decoder.decode(null, null,
+ verifyPositions(decoder, text(
"*GS16,351535059439208,103441131015,,GPS:A;8;N31.960122;E35.921652;27;99;847;1.33;2.41,GSM:1;4;416;3;AF0;9C73;-61;416;3;AF0;9C89;-68,OBD:04410C0DA403410D0B03411C010341057A037F011203411100$103453131015,,GPS:A;8;N31.959976;E35.922144;6;0;835;1.33;2.41,GSM:1;4;416;3;AF0;9C73;-67;416;3;AF0;9C89;-64;416;3;AF0;B389;-83,OBD:04410C0D8E03410D0B03411C010341057D037F011203411100$103503131015,,GPS:A;9;N31.959870;E35.922284;11;127;830;1.33;2.41,GSM:1;4;416;3;AF0;9C73;-67;416;3;AF0;9C89;-64;416;3;AF0;B389;-83,OBD:04410C0D8E03410D0B03411C010341057D037F011203411100$103513131015,,GPS:A;9;N31.959742;E35.922516;10;106;830;1.37;2.91,GSM:1;4;416;3;AF0;9C73;-67;416;3;AF0;9C89;-64;416;3;AF0;B389;-83,OBD:04410C0D1003410D0603411C010341057E037F011203411100$103553131015,,GPS:A;8;N31.959564;E35.923308;6;0;836;1.41;2.43,GSM:1;4;416;3;AF0;9C73;-65;416;3;AF0;B389;-71;416;3;AF0;9C89;-74,OBD:04410C0DAE03410D0403411C010341057C037F011203411100#"));
- verify(decoder.decode(null, null,
+ verifyPositions(decoder, text(
"*GS16,351535058709775,100356130215,,SYS:G79W;V1.06;V1.0.2,GPS:A;6;N24.802700;E46.616828;0;0;684;1.35,COT:60,ADC:4.31;0.10,DTT:20000;;0;0;0;1"));
- verify(decoder.decode(null, null,
+ verifyPositions(decoder, text(
"*GS16,351535059439208,155750220815,,SYS:G79;V1.10;V1.0.2,GPS:A;4;N31.944198;E35.846644;0;0;923;9.47;1.00,COT:155133,ADC:12.21;0.10,DTT:20002;;0;0;0;1#"));
- verify(decoder.decode(null, null,
+ verifyPositions(decoder, text(
"*GS16,351535059439208,070034220815,,SYS:G79;V1.10;V1.0.2,GPS:A;8;N31.945970;E35.859848;29;65;922;1.14;1.68,COT:147528,ADC:14.07;0.11,DTT:27006;;0;0;0;3,OBD:04410C1ECD03410D2D03411C010341057A037F011203411107$070035220815,,SYS:G79;V1.10;V1.0.2,GPS:A;8;N31.945934;E35.859908;29;86;922;1.14;1.68,COT:147528,ADC:13.94;0.15,DTT:27006;;0;0;0;3,OBD:04410C1ECD03410D2D03411C010341057A037F011203411107$070037220815,,SYS:G79;V1.10;V1.0.2,GPS:A;8;N31.945844;E35.859952;29;123;922;1.14;1.68,COT:147625,ADC:13.75;0.11,DTT:27006;;0;0;0;3,OBD:04410C0FE803410D1803411C010341057C037F011203411100$070038220815,,SYS:G79;V1.10;V1.0.2,GPS:A;8;N31.945808;E35.859940;29;145;923;1.14;1.68,COT:147625,ADC:14.00;0.11,DTT:27006;;0;0;0;3,OBD:04410C0FE803410D1803411C010341057C037F011203411100#"));
}
diff --git a/test/org/traccar/protocol/GotopProtocolDecoderTest.java b/test/org/traccar/protocol/GotopProtocolDecoderTest.java
index 260114bc7..dcafd5add 100644
--- a/test/org/traccar/protocol/GotopProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/GotopProtocolDecoderTest.java
@@ -1,8 +1,7 @@
package org.traccar.protocol;
-import static org.traccar.helper.DecoderVerifier.verify;
-import static org.junit.Assert.assertNull;
import org.junit.Test;
+import org.traccar.ProtocolDecoderTest;
public class GotopProtocolDecoderTest extends ProtocolDecoderTest {
@@ -11,23 +10,23 @@ public class GotopProtocolDecoderTest extends ProtocolDecoderTest {
GotopProtocolDecoder decoder = new GotopProtocolDecoder(new GotopProtocol());
- assertNull(decoder.decode(null, null, ""));
+ verifyNothing(decoder, text( ""));
- assertNull(decoder.decode(null, null, "353327020412763,CMD-X"));
+ verifyNothing(decoder, text( "353327020412763,CMD-X"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"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"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"353327020115804,CMD-T,A,DATE:090329,TIME:223252,LAT:22.7634066N,LOT:114.3964783E,Speed:000.0,84-20,000"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"353327020115804,CMD-T,A,DATE:090329,TIME:223252,LAT:22.7634066N,LOT:114.3964783E,Speed:000.0,1-1-0-84-20,000"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"353327020412763,CMD-F,V,DATE:140125,TIME:183636,LAT:51.6384466N,LOT:000.2863866E,Speed:000.0,61-19,"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"013949008891817,CMD-F,A,DATE:150225,TIME:175441,LAT:50.000000N,LOT:008.000000E,Speed:085.9,0-0-0-0-52-31,000,26201-1073-1DF5"));
}
diff --git a/test/org/traccar/protocol/Gps103ProtocolDecoderTest.java b/test/org/traccar/protocol/Gps103ProtocolDecoderTest.java
index 96078b509..d238e5623 100644
--- a/test/org/traccar/protocol/Gps103ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/Gps103ProtocolDecoderTest.java
@@ -1,8 +1,7 @@
package org.traccar.protocol;
-import static org.junit.Assert.assertNull;
import org.junit.Test;
-import static org.traccar.helper.DecoderVerifier.verify;
+import org.traccar.ProtocolDecoderTest;
public class Gps103ProtocolDecoderTest extends ProtocolDecoderTest {
@@ -12,116 +11,116 @@ public class Gps103ProtocolDecoderTest extends ProtocolDecoderTest {
Gps103ProtocolDecoder decoder = new Gps103ProtocolDecoder(new Gps103Protocol());
// Log on request
- assertNull(decoder.decode(null, null, "##,imei:359586015829802,A"));
+ verifyNothing(decoder, text( "##,imei:359586015829802,A"));
// Heartbeat package
- assertNull(decoder.decode(null, null, "359586015829802"));
+ verifyNothing(decoder, text( "359586015829802"));
// No GPS signal
- assertNull(decoder.decode(null, null, "imei:359586015829802,tracker,000000000,13554900601,L,;"));
+ verifyNothing(decoder, text( "imei:359586015829802,tracker,000000000,13554900601,L,;"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"imei:869039001186913,tracker,1308282156,0,F,215630.000,A,5602.11015,N,9246.30767,E,1.4,,175.9,"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"imei:359710040656622,tracker,13/02/27 23:40,,F,125952.000,A,3450.9430,S,13828.6753,E,0.00,0"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"imei:359710040565419,tracker,13/05/25 14:23,,F,062209.000,A,0626.0411,N,10149.3904,E,0.00,0"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"imei:353451047570260,tracker,1302110948,,F,144807.000,A,0805.6615,S,07859.9763,W,0.00,,"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"imei:359587016817564,tracker,1301251602,,F,080251.000,A,3223.5832,N,11058.9449,W,0.03,"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"imei:359587016817564,tracker,1301251602,,F,080251.000,A,3223.5832,N,11058.9449,W,,"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"imei:012497000208821,tracker,1301080525,,F,212511.000,A,2228.5279,S,06855.6328,W,18.62,268.98,"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"imei:012497000208821,tracker,1301072224,,F,142411.077,A,2227.0739,S,06855.2912,,0,0,"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"imei:012497000431811,tracker,1210260609,,F,220925.000,A,0845.5500,N,07024.7673,W,0.00,,"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"imei:100000000000000,help me,1004171910,,F,010203.000,A,0102.0003,N,00102.0003,E,1.02,"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"imei:353451040164707,tracker,1105182344,+36304665439,F,214418.000,A,4804.2222,N,01916.7593,E,0.37,"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"imei:353451042861763,tracker,1106132241,,F,144114.000,A,2301.9052,S,04909.3676,W,0.13,"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"imei:359587010124900,tracker,0809231929,13554900601,F,112909.397,A,2234.4669,N,11354.3287,E,0.11,321.53,"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"imei:353451049926460,tracker,1208042043,123456 99008026,F,124336.000,A,3509.8668,N,03322.7636,E,0.00,,"));
// SOS alarm
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"imei:359586015829802,help me,0809231429,13554900601,F,062947.294,A,2234.4026,N,11354.3277,E,0.00,"));
// Low battery alarm
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"imei:359586015829802,low battery,0809231429,13554900601,F,062947.294,A,2234.4026,N,11354.3277,E,0.00,"));
// Geo-fence alarm
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"imei:359586015829802,stockade,0809231429,13554900601,F,062947.294,A,2234.4026,N,11354.3277,E,0.00,"));
// Move alarm
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"imei:359586015829802,move,0809231429,13554900601,F,062947.294,A,2234.4026,N,11354.3277,E,0.00,"));
// Over speed alarm
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"imei:359586015829802,speed,0809231429,13554900601,F,062947.294,A,2234.4026,N,11354.3277,E,0.00,"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"imei:863070010423167,tracker,1211051840,,F,104000.000,A,2220.6483,N,11407.6377,,0,0,"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"imei:863070010423167,tracker,1211051951,63360926,F,115123.000,A,2220.6322,N,11407.5313,E,0.00,,"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"imei:863070010423167,tracker,1211060621,,F,062152.000,A,2220.6914,N,11407.5506,E,15.85,347.84,"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"imei:863070012698733,tracker,1303092334,,F,193427.000,A,5139.0369,N,03907.2791,E,0.00,,"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"imei:869039001186913,tracker,130925065533,0,F,065533.000,A,5604.11015,N,9232.12238,E,0.0,,329.0,"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"imei:359710041641581,acc alarm,1402231159,,F,065907.000,A,2456.2591,N,06708.8335,E,7.53,76.10,,1,0,0.03%,,"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"imei:359710041641581,acc alarm,1402231159,,F,065907.000,A,2456.2591,N,06708.8335,E,7.53,76.10,,1,0,0.03%,,"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"imei:313009071131684,tracker,1403211928,,F,112817.000,A,0610.1133,N,00116.5840,E,0.00,,,0,0,0.0,0.0,"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"imei:866989771979791,tracker,140527055653,,F,215653.00,A,5050.33113,N,00336.98783,E,0.066,0"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"imei:353552045375005,tracker,150401165832,61.0,F,31.0,A,1050.73696,N,10636.49489,E,8.0,,22.0,"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"imei:353552045403597,tracker,150420050648,53.0,F,0.0,A,N,5306.64155,E,00700.77848,0.0,,1.0,;"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"imei:353552045403597,tracker,150420051153,53.0,F,0.0,A,5306.64155,N,00700.77848,E,0.0,,1.0,;"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"imei:359710047424644,tracker,150506224036,,F,154037.000,A,0335.2785,N,09841.1543,E,3.03,337.54,,0,0,45.16%,,;"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"imei:865328023776874,acc off,150619152221,,F,072218.000,A,5439.8489,N,02518.5945,E,0.00,,,1,1,0.0,0.0,23.0,;"));
}
diff --git a/test/org/traccar/protocol/GpsGateProtocolDecoderTest.java b/test/org/traccar/protocol/GpsGateProtocolDecoderTest.java
index 0913ae2f8..8652b24a6 100644
--- a/test/org/traccar/protocol/GpsGateProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/GpsGateProtocolDecoderTest.java
@@ -1,8 +1,7 @@
package org.traccar.protocol;
-import static org.traccar.helper.DecoderVerifier.verify;
-import static org.junit.Assert.assertNull;
import org.junit.Test;
+import org.traccar.ProtocolDecoderTest;
public class GpsGateProtocolDecoderTest extends ProtocolDecoderTest {
@@ -11,18 +10,18 @@ public class GpsGateProtocolDecoderTest extends ProtocolDecoderTest {
GpsGateProtocolDecoder decoder = new GpsGateProtocolDecoder(new GpsGateProtocol());
- assertNull(decoder.decode(null, null, "$FRLIN,,user1,8IVHF*7A"));
+ verifyNothing(decoder, text( "$FRLIN,,user1,8IVHF*7A"));
- assertNull(decoder.decode(null, null, "$FRLIN,,354503026292842,VGZTHKT*0C"));
+ verifyNothing(decoder, text( "$FRLIN,,354503026292842,VGZTHKT*0C"));
- assertNull(decoder.decode(null, null, "$FRLIN,IMEI,1234123412341234,*7B"));
+ verifyNothing(decoder, text( "$FRLIN,IMEI,1234123412341234,*7B"));
- assertNull(decoder.decode(null, null, "$FRLIN,,saab93_device,KLRFBGIVDJ*28"));
+ verifyNothing(decoder, text( "$FRLIN,,saab93_device,KLRFBGIVDJ*28"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"$GPRMC,154403.000,A,6311.64120,N,01438.02740,E,0.000,0.0,270707,,*0A"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"$GPRMC,074524,A,5553.73701,N,03728.90491,E,10.39,226.5,160614,0.0,E*75"));
}
diff --git a/test/org/traccar/protocol/GpsMarkerProtocolDecoderTest.java b/test/org/traccar/protocol/GpsMarkerProtocolDecoderTest.java
index 6e3ef6c8a..28237b5b2 100644
--- a/test/org/traccar/protocol/GpsMarkerProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/GpsMarkerProtocolDecoderTest.java
@@ -1,9 +1,8 @@
package org.traccar.protocol;
import org.junit.Test;
+import org.traccar.ProtocolDecoderTest;
-import static org.junit.Assert.assertNull;
-import static org.traccar.helper.DecoderVerifier.verify;
public class GpsMarkerProtocolDecoderTest extends ProtocolDecoderTest {
@@ -13,16 +12,16 @@ public class GpsMarkerProtocolDecoderTest extends ProtocolDecoderTest {
GpsMarkerProtocolDecoder decoder = new GpsMarkerProtocolDecoder(new GpsMarkerProtocol());
- assertNull(decoder.decode(null, null,
+ verifyNothing(decoder, text(
"$GM300350123456789012T100511123300G25000001772F185200000000000000005230298#"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"$GM200350123456789012T100511123300N55516789E03756123400000035230298#"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"$GM1350123456789012T1005111233N55516789E03756123400000035200298#"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"$GM203863071014445404T150715202258N55481576E03729275300000040530301#"));
}
diff --git a/test/org/traccar/protocol/GpsmtaProtocolDecoderTest.java b/test/org/traccar/protocol/GpsmtaProtocolDecoderTest.java
index f6c51bf6e..fb5e83900 100644
--- a/test/org/traccar/protocol/GpsmtaProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/GpsmtaProtocolDecoderTest.java
@@ -1,8 +1,7 @@
package org.traccar.protocol;
import org.junit.Test;
-
-import static org.traccar.helper.DecoderVerifier.verify;
+import org.traccar.ProtocolDecoderTest;
public class GpsmtaProtocolDecoderTest extends ProtocolDecoderTest {
@@ -11,7 +10,7 @@ public class GpsmtaProtocolDecoderTest extends ProtocolDecoderTest {
GpsmtaProtocolDecoder decoder = new GpsmtaProtocolDecoder(new GpsmtaProtocol());
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"359144048138856 1442932957 49.85064 24.003979 1 0 40 0 10 110 26 0 0"));
}
diff --git a/test/org/traccar/protocol/Gt02ProtocolDecoderTest.java b/test/org/traccar/protocol/Gt02ProtocolDecoderTest.java
index 17c557c69..76590fe3f 100644
--- a/test/org/traccar/protocol/Gt02ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/Gt02ProtocolDecoderTest.java
@@ -1,10 +1,9 @@
package org.traccar.protocol;
import org.jboss.netty.buffer.ChannelBuffers;
-import static org.junit.Assert.assertNull;
import org.junit.Test;
+import org.traccar.ProtocolDecoderTest;
import org.traccar.helper.ChannelBufferTools;
-import static org.traccar.helper.DecoderVerifier.verify;
public class Gt02ProtocolDecoderTest extends ProtocolDecoderTest {
@@ -13,14 +12,14 @@ public class Gt02ProtocolDecoderTest extends ProtocolDecoderTest {
Gt02ProtocolDecoder decoder = new Gt02ProtocolDecoder(new Gt02Protocol());
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "68682500000123456789012345000110010101010101026B3F3E026B3F3E000000000000000000010D0A"))));
+ verifyPosition(decoder, binary(
+ "68682500000123456789012345000110010101010101026B3F3E026B3F3E000000000000000000010D0A"));
- assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "6868110603035889905101276600001a0402292d0d0a"))));
+ verifyNothing(decoder, binary(
+ "6868110603035889905101276600001a0402292d0d0a"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "68682500a403588990510127660001100e09060a1d1b00ade1c90b79ea3000011b000000000000050d0a"))));
+ verifyPosition(decoder, binary(
+ "68682500a403588990510127660001100e09060a1d1b00ade1c90b79ea3000011b000000000000050d0a"));
}
diff --git a/test/org/traccar/protocol/Gt06ProtocolDecoderTest.java b/test/org/traccar/protocol/Gt06ProtocolDecoderTest.java
index d3a588e48..e95d55e23 100644
--- a/test/org/traccar/protocol/Gt06ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/Gt06ProtocolDecoderTest.java
@@ -3,10 +3,9 @@ package org.traccar.protocol;
import org.jboss.netty.buffer.ChannelBuffers;
import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
import org.junit.Test;
+import org.traccar.ProtocolDecoderTest;
import org.traccar.helper.ChannelBufferTools;
-import static org.traccar.helper.DecoderVerifier.verify;
public class Gt06ProtocolDecoderTest extends ProtocolDecoderTest {
@@ -15,53 +14,54 @@ public class Gt06ProtocolDecoderTest extends ProtocolDecoderTest {
Gt06ProtocolDecoder decoder = new Gt06ProtocolDecoder(new Gt06Protocol());
- assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "787811010123456789012345100B3201000171930D0A"))));
+ verifyNothing(decoder, binary(
+ "787811010123456789012345100B3201000171930D0A"));
- assertNotNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "78780a13440604000201baaf540d0a"))));
+ verifyAttributes(decoder, binary(
+ "78780a13440604000201baaf540d0a"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "787823120f081b121d37cb01c8e2cc08afd3c020d50201940701d600a1190041ee100576d1470d0a"))));
+ verifyPosition(decoder, binary(
+ "787823120f081b121d37cb01c8e2cc08afd3c020d50201940701d600a1190041ee100576d1470d0a"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "78781F120B081D112E10CC027AC7EB0C46584900148F01CC00287D001FB8000380810D0A"))));
+ verifyPosition(decoder, binary(
+ "78781F120B081D112E10CC027AC7EB0C46584900148F01CC00287D001FB8000380810D0A"));
- assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "78780D01086471700328358100093F040D0A"))));
+ verifyNothing(decoder, binary(
+ "78780D01086471700328358100093F040D0A"));
- assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "78780D01012345678901234500018CDD0D0A"))));
+ verifyNothing(decoder, binary(
+ "78780D01012345678901234500018CDD0D0A"));
- assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "78780d0103534190360660610003c3df0d0a"))));
+ verifyNothing(decoder, binary(
+ "78780d0103534190360660610003c3df0d0a"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "787819100B031A0B1B31CC027AC7FD0C4657BF0115210001001CC6070D0A"))));
+ verifyPosition(decoder, binary(
+ "787819100B031A0B1B31CC027AC7FD0C4657BF0115210001001CC6070D0A"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "787821120C010C0F151FCF027AC8840C4657EC00140001CC00287D001F720001000F53A00D0A"))));
+ verifyPosition(decoder, binary(
+ "787821120C010C0F151FCF027AC8840C4657EC00140001CC00287D001F720001000F53A00D0A"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "787825160B051B093523CF027AC8360C4657B30014000901CC00266A001E1740050400020008D7B10D0A"))));
+ verifyPosition(decoder, binary(
+ "787825160B051B093523CF027AC8360C4657B30014000901CC00266A001E1740050400020008D7B10D0A"));
+ // 12345678901234567890123456789012345678901234567890123456789012345678901234567890
- assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "787811010864717003664467100f190a0002c6d20d0a"))));
+ verifyNothing(decoder, binary(
+ "787811010864717003664467100f190a0002c6d20d0a"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "787819100e010903230ec803ae32a60653cded00180000020072feb70d0a"))));
+ verifyPosition(decoder, binary(
+ "787819100e010903230ec803ae32a60653cded00180000020072feb70d0a"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "7878471e0e03110b0511c501c664fd074db73f0218a602e003433a002fed40433a0056e14e433a0056104e433a0056fd53433a002eed55433a007e4b57433a002ee25aff00020120f6720d0a"))));
+ verifyPosition(decoder, binary(
+ "7878471e0e03110b0511c501c664fd074db73f0218a602e003433a002fed40433a0056e14e433a0056104e433a0056fd53433a002eed55433a007e4b57433a002ee25aff00020120f6720d0a"));
- assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "7979005bfd0358899050927725004c0020bf984358df603b2ea3a339e54335013a5b56455253494f4e5d47543036445f32305f3630444d325f423235455f5631355f574d5b4255494c445d323031332f31322f32382031353a3234002a3b240d0a7979005bfd0358899050927725004c0020bf984358df603b2ea3a339e54335013a5b56455253494f4e5d47543036445f32305f3630444d325f423235455f5631355f574d5b4255494c445d323031332f31322f32382031353a3234002d4f9b0d0a7979005bfd0358899050927725004c0020bf984358df603b2ea3a339e54335013a5b56455253494f4e5d47543036445f32305f3630444d325f423235455f5631355f574d5b4255494c445d323031332f31322f32382031353a3234003084ff0d0a"))));
+ verifyNothing(decoder, binary(
+ "7979005bfd0358899050927725004c0020bf984358df603b2ea3a339e54335013a5b56455253494f4e5d47543036445f32305f3630444d325f423235455f5631355f574d5b4255494c445d323031332f31322f32382031353a3234002a3b240d0a7979005bfd0358899050927725004c0020bf984358df603b2ea3a339e54335013a5b56455253494f4e5d47543036445f32305f3630444d325f423235455f5631355f574d5b4255494c445d323031332f31322f32382031353a3234002d4f9b0d0a7979005bfd0358899050927725004c0020bf984358df603b2ea3a339e54335013a5b56455253494f4e5d47543036445f32305f3630444d325f423235455f5631355f574d5b4255494c445d323031332f31322f32382031353a3234003084ff0d0a"));
- assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "78788b818300000000534545464e2626004f04220045042626262b37393035343031353534362626262626260410041b0415041a04210415041926262b373930363433333031313526260410043d044f26262b373936303437383430363426260412043e0432043026262b373932383834373738383126262626262626262626262626262626232300020022155d0d0a"))));
+ verifyNothing(decoder, binary(
+ "78788b818300000000534545464e2626004f04220045042626262b37393035343031353534362626262626260410041b0415041a04210415041926262b373930363433333031313526260410043d044f26262b373936303437383430363426260412043e0432043026262b373932383834373738383126262626262626262626262626262626232300020022155d0d0a"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "787822220e0914160f07c9021a362805090a7800d8b802d402c30e00a98a0105010213f4bb0d0a"))));
+ verifyPosition(decoder, binary(
+ "787822220e0914160f07c9021a362805090a7800d8b802d402c30e00a98a0105010213f4bb0d0a"));
}
diff --git a/test/org/traccar/protocol/H02ProtocolDecoderTest.java b/test/org/traccar/protocol/H02ProtocolDecoderTest.java
index aba05d915..787b1596e 100644
--- a/test/org/traccar/protocol/H02ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/H02ProtocolDecoderTest.java
@@ -1,11 +1,8 @@
package org.traccar.protocol;
-import java.nio.charset.Charset;
import org.jboss.netty.buffer.ChannelBuffers;
-import static org.junit.Assert.assertNull;
import org.junit.Test;
-import org.traccar.helper.ChannelBufferTools;
-import static org.traccar.helper.DecoderVerifier.verify;
+import org.traccar.ProtocolDecoderTest;
public class H02ProtocolDecoderTest extends ProtocolDecoderTest {
@@ -14,98 +11,98 @@ public class H02ProtocolDecoderTest extends ProtocolDecoderTest {
H02ProtocolDecoder decoder = new H02ProtocolDecoder(new H02Protocol());
- verify(decoder.decode(null, null, ChannelBuffers.copiedBuffer(
- "*HQ,355488020119695,V1,050418,,2827.61232,N,07703.84822,E,0.00,0,031015,FFFEFBFF#", Charset.defaultCharset())));
+ verifyPosition(decoder, buffer(
+ "*HQ,355488020119695,V1,050418,,2827.61232,N,07703.84822,E,0.00,0,031015,FFFEFBFF#"));
- verify(decoder.decode(null, null, ChannelBuffers.copiedBuffer(
- "*HQ,1451316409,V1,030149,A,-23-29.0095,S,-46-51.5852,W,2.4,065,070315,FFFFFFFF#", Charset.defaultCharset())));
+ verifyPosition(decoder, buffer(
+ "*HQ,1451316409,V1,030149,A,-23-29.0095,S,-46-51.5852,W,2.4,065,070315,FFFFFFFF#"));
- 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())));
+ verifyNothing(decoder, buffer(
+ "*HQ,353588020068342,V1,000000,V,0.0000,0,0.0000,0,0.00,0.00,000000,ffffffff,000106,000002,000203,004c87,16#"));
- 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())));
+ verifyPosition(decoder, buffer(
+ "*HQ,3800008786,V1,062507,V,3048.2437,N,03058.5617,E,000.00,000,250413,FFFFFBFF#"));
- 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())));
+ verifyPosition(decoder, buffer(
+ "*HQ,4300256455,V1,111817,A,1935.5128,N,04656.3243,E,0.00,100,170913,FFE7FBFF#"));
- 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())));
+ verifyPosition(decoder, buffer(
+ "*HQ,123456789012345,V1,155850,A,5214.5346,N,2117.4683,E,0.00,270.90,131012,ffffffff,000000,000000,000000,000000#"));
- 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())));
+ verifyPosition(decoder, buffer(
+ "*HQ,353588010001689,V1,221116,A,1548.8220,S,4753.1679,W,0.00,0.00,300413,ffffffff,0002d4,000004,0001cd,000047#"));
- 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())));
+ verifyPosition(decoder, buffer(
+ "*HQ,354188045498669,V1,195200,A,701.8915,S,3450.3399,W,0.00,205.70,050213,ffffffff,000243,000000,000000#"));
- 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())));
+ verifyPosition(decoder, buffer(
+ "*HQ,2705171109,V1,213324,A,5002.5849,N,01433.7822,E,0.00,000,140613,FFFFFFFF#"));
- 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())));
+ verifyPosition(decoder, buffer(
+ "*TH,2020916012,V1,050316,A,2212.8745,N,11346.6574,E,14.28,028,220902,FFFFFBFF#"));
- 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())));
+ verifyPosition(decoder, buffer(
+ "*TH,2020916012,V4,S17,130305,050316,A,2212.8745,N,11346.6574,E,14.28,028,220902,FFFFFBFF#"));
- 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())));
+ verifyPosition(decoder, buffer(
+ "*TH,2020916012,V4,S14,100,10,1,3,130305,050316,A,2212.8745,N,11346.6574,E,14.28,028,220902,FFFFFBFF#"));
- 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())));
+ verifyPosition(decoder, buffer(
+ "*TH,2020916012,V4,S20,ERROR,130305,050316,A,2212.8745,N,11346.6574,E,14.28,028,220902,FFFFFBFF#"));
- 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())));
+ verifyPosition(decoder, buffer(
+ "*TH,2020916012,V4,S20,DONE,130305,050316,A,2212.8745,N,11346.6574,E,14.28,028,220902,F7FFFBFF#"));
- 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())));
+ verifyPosition(decoder, buffer(
+ "*TH,2020916012,V4,R8,ERROR,130305,050316,A,2212.8745,N,11346.6574,E,14.28,028,220902,FFFFFBFF#"));
- 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())));
+ verifyPosition(decoder, buffer(
+ "*TH,2020916012,V4,S23,165.165.33.250:8800,130305,050316,A,2212.8745,N,11346.6574,E,14.28,028,220902,FFFFFBFF#"));
- 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())));
+ verifyPosition(decoder, buffer(
+ "*TH,2020916012,V4,S24,thit.gd,130305,050316,A,2212.8745,N,11346.6574,E,14.28,028,220902,FFFFFBFF#"));
- 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())));
+ verifyPosition(decoder, buffer(
+ "*TH,2020916012,V4,S1,OK,pass_word,130305,050316,A,2212.8745,N,11346.6574,E,14.28,028,220902,FFFFFBFD#"));
- 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())));
+ verifyPosition(decoder, buffer(
+ "*HQ,353588020068342,V1,062840,A,5241.1249,N,954.9490,E,0.00,0.00,231013,ffffffff,000106,000002,000203,004c87,24#"));
- 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())));
+ verifyPosition(decoder, buffer(
+ "*HQ,353505220903211,V1,075228,A,5227.5039,N,01032.8443,E,0.00,0,231013,FFFBFFFF,106,14, 201,2173#"));
- 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())));
+ verifyPosition(decoder, buffer(
+ "*HQ,353505220903211,V1,140817,A,5239.3538,N,01003.5292,E,21.03,312,221013,FFFBFFFF,106,14, 203,1cd#"));
- verify(decoder.decode(null, null, ChannelBuffers.copiedBuffer(
- "*HQ,356823035368767,V1,083618,A,0955.6392,N,07809.0796,E,0.00,0,070414,FFFBFFFF,194,3b5, 71,c9a9#", Charset.defaultCharset())));
-
- assertNull(decoder.decode(null, null, ChannelBuffers.copiedBuffer(
- "*HQ,8401016597,BASE,152609,0,0,0,0,211014,FFFFFFFF#", Charset.defaultCharset())));
+ verifyPosition(decoder, buffer(
+ "*HQ,356823035368767,V1,083618,A,0955.6392,N,07809.0796,E,0.00,0,070414,FFFBFFFF,194,3b5, 71,c9a9#"));
+
+ verifyNothing(decoder, buffer(
+ "*HQ,8401016597,BASE,152609,0,0,0,0,211014,FFFFFFFF#"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "24410600082621532131081504419390060740418306000000fffffbfdff0015060000002c02dc0c000000001f"))));
+ verifyPosition(decoder, binary(
+ "24410600082621532131081504419390060740418306000000fffffbfdff0015060000002c02dc0c000000001f"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "2427051711092133391406135002584900014337822e000000ffffffffff0000"))));
+ verifyPosition(decoder, binary(
+ "2427051711092133391406135002584900014337822e000000ffffffffff0000"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "2427051711092134091406135002584900014337822e000000ffffffffff0000"))));
+ verifyPosition(decoder, binary(
+ "2427051711092134091406135002584900014337822e000000ffffffffff0000"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "2410307310010503162209022212874500113466574C014028fffffbffff0000"))));
+ verifyPosition(decoder, binary(
+ "2410307310010503162209022212874500113466574C014028fffffbffff0000"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "2441090013450831250401145047888000008554650e000000fffff9ffff001006000000000106020299109c01"))));
+ verifyPosition(decoder, binary(
+ "2441090013450831250401145047888000008554650e000000fffff9ffff001006000000000106020299109c01"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "24270517030820321418041423307879000463213792000056fffff9ffff0000"))));
+ verifyPosition(decoder, binary(
+ "24270517030820321418041423307879000463213792000056fffff9ffff0000"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "2441091144271222470112142233983006114026520E000000FFFFFBFFFF0014060000000001CC00262B0F170A"))));
+ verifyPosition(decoder, binary(
+ "2441091144271222470112142233983006114026520E000000FFFFFBFFFF0014060000000001CC00262B0F170A"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "24971305007205201916101533335008000073206976000000effffbffff000252776566060000000000000000000049"))));
+ verifyPosition(decoder, binary(
+ "24971305007205201916101533335008000073206976000000effffbffff000252776566060000000000000000000049"));
}
diff --git a/test/org/traccar/protocol/HaicomProtocolDecoderTest.java b/test/org/traccar/protocol/HaicomProtocolDecoderTest.java
index 03257b6bd..df1c33a06 100644
--- a/test/org/traccar/protocol/HaicomProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/HaicomProtocolDecoderTest.java
@@ -1,7 +1,7 @@
package org.traccar.protocol;
-import static org.traccar.helper.DecoderVerifier.verify;
import org.junit.Test;
+import org.traccar.ProtocolDecoderTest;
public class HaicomProtocolDecoderTest extends ProtocolDecoderTest {
@@ -10,16 +10,16 @@ public class HaicomProtocolDecoderTest extends ProtocolDecoderTest {
HaicomProtocolDecoder decoder = new HaicomProtocolDecoder(new HaicomProtocol());
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"$GPRS012497007097169,T100001,150618,230031,5402267400332464,0004,2014,000001,,,1,00#V040*"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"$GPRS123456789012345,602S19A,100915,063515,7240649312041079,0019,3156,111000,10004,0000,11111,00LH#V037"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"$GPRS123456789012345,T100001,141112,090751,7240649312041079,0002,1530,000001,,,1,00#V039*"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"$GPRS012497007101250,T100001,141231,152235,7503733600305643,0000,2285,000001,,,1,00#V041*"));
}
diff --git a/test/org/traccar/protocol/IntellitracProtocolDecoderTest.java b/test/org/traccar/protocol/IntellitracProtocolDecoderTest.java
index d4f88e42d..9cba712bb 100644
--- a/test/org/traccar/protocol/IntellitracProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/IntellitracProtocolDecoderTest.java
@@ -1,8 +1,7 @@
package org.traccar.protocol;
-import static org.junit.Assert.assertNull;
import org.junit.Test;
-import static org.traccar.helper.DecoderVerifier.verify;
+import org.traccar.ProtocolDecoderTest;
public class IntellitracProtocolDecoderTest extends ProtocolDecoderTest {
@@ -11,51 +10,51 @@ public class IntellitracProtocolDecoderTest extends ProtocolDecoderTest {
IntellitracProtocolDecoder decoder = new IntellitracProtocolDecoder(new IntellitracProtocol());
- assertNull(decoder.decode(null, null, "$OK:TRACKING"));
+ verifyNothing(decoder, text( "$OK:TRACKING"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"101000001,20100304075545,121.64547,25.06200,0,0,61,7,2,1,0,0.046,0.000,20100304075546,0"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"1010000002,20030217132813,121.646060,25.061725,20,157,133,7,0,11,15,0.096,0.000"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"1010000002,20030217132813,121.646060,25.061725,20,157,-133,7,0,11,15,0.096,0.000"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"1001070919,20130405084206,37.903730,48.011377,0,0,235,10,2,2,0,20.211,0.153"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"1010000002,20030217144230,121.646102,25.061398,0,0,139,0,0,0,0,0.093,0.000"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"1010000004,20050513153524,121.646075,25.063675,0,166,50,6,1,0,0,0.118,0.000"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"1010000004,20050513154001,121.646075,25.063675,0,166,55,7,1,0,0,0.096,0.000"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"1010000002,20030217132813,121.646060,25.061725,20,157,0,7,0,11,15"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"12345,1010000002,20030217132813,121.646060,25.061725,20,157,0,7,0,11,15"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"1010000002,20030217144230,121.646102,25.061398,0,0,0,7,2,0,0"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"$RP:12345,1010000002,20030217144230,121.646102,25.061398,0,0,0,7,2,0,0"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"1010000001,20030105092129,121.651598,25.052325,0,0,33,0,1,0,0"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"1010000001,20030105092129,-121.651598,-25.052325,0,0,33,0,1,0,0"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"1015210962,20131010144712,-77.070037,-12.097935,0,0,77,7,2,2,0,0,139446.8,2095,20131010144712,,0.103,0.000"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"1003269480,20131126100258,10.32989,49.93836,0,304,217,6,2,0,0,0.000,0.000,20131126100258,0,0,0,-40,0,0,-273,0,0,0,0"));
}
diff --git a/test/org/traccar/protocol/Jt600ProtocolDecoderTest.java b/test/org/traccar/protocol/Jt600ProtocolDecoderTest.java
index 24ba109d9..8acdbe15b 100644
--- a/test/org/traccar/protocol/Jt600ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/Jt600ProtocolDecoderTest.java
@@ -1,10 +1,10 @@
package org.traccar.protocol;
+import org.traccar.ProtocolDecoderTest;
import org.traccar.helper.ChannelBufferTools;
import java.nio.charset.Charset;
import org.jboss.netty.buffer.ChannelBuffers;
-import static org.traccar.helper.DecoderVerifier.verify;
import org.junit.Test;
public class Jt600ProtocolDecoderTest extends ProtocolDecoderTest {
@@ -14,28 +14,28 @@ public class Jt600ProtocolDecoderTest extends ProtocolDecoderTest {
Jt600ProtocolDecoder decoder = new Jt600ProtocolDecoder(new Jt600Protocol());
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "24311021600111001B16021105591022329862114046227B0598095080012327951435161F"))));
+ verifyPosition(decoder, binary(
+ "24311021600111001B16021105591022329862114046227B0598095080012327951435161F"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "24312082002911001B171012052831243810120255336425001907190003FD2B91044D1FA0"))));
+ verifyPosition(decoder, binary(
+ "24312082002911001B171012052831243810120255336425001907190003FD2B91044D1FA0"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "24312082002911001B1710120533052438099702553358450004061E0003EE000000000C00"))));
+ verifyPosition(decoder, binary(
+ "24312082002911001B1710120533052438099702553358450004061E0003EE000000000C00"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "24608111888821001B09060908045322564025113242329F0598000001003F0000002D00AB"))));
+ verifyPosition(decoder, binary(
+ "24608111888821001B09060908045322564025113242329F0598000001003F0000002D00AB"));
- 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())));
+ verifyPosition(decoder, buffer(
+ "(3110312099,W01,11404.6204,E,2232.9961,N,A,040511,063736,4,7,100,4,17,1,1,company)"));
- 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())));
+ verifyPosition(decoder, buffer(
+ "(3120820029,W01,02553.3555,E,2438.0997,S,A,171012,053339,0,8,20,6,31,5,20,20)"));
- /*verify(decoder.decode(null, null, ChannelBuffers.copiedBuffer(
+ /*verifyPosition(decoder, text( ChannelBuffers.copiedBuffer(
"(3330104377,U01,010100,010228,F,00.000000,N,000.000000,E,0,0,0,0%,00001000000000,741,14,22,0,206)", Charset.defaultCharset())));
- verify(decoder.decode(null, null, ChannelBuffers.copiedBuffer(
+ verifyPosition(decoder, text( 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/KhdProtocolDecoderTest.java b/test/org/traccar/protocol/KhdProtocolDecoderTest.java
index 7f9eb4a7a..ec013f619 100644
--- a/test/org/traccar/protocol/KhdProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/KhdProtocolDecoderTest.java
@@ -1,9 +1,9 @@
package org.traccar.protocol;
import org.jboss.netty.buffer.ChannelBuffers;
-import static org.traccar.helper.DecoderVerifier.verify;
-import static org.junit.Assert.assertNull;
+
import org.junit.Test;
+import org.traccar.ProtocolDecoderTest;
import org.traccar.helper.ChannelBufferTools;
public class KhdProtocolDecoderTest extends ProtocolDecoderTest {
@@ -13,32 +13,32 @@ public class KhdProtocolDecoderTest extends ProtocolDecoderTest {
KhdProtocolDecoder decoder = new KhdProtocolDecoder(new KhdProtocol());
- assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "2929b1000605162935b80d"))));
+ verifyNothing(decoder, binary(
+ "2929b1000605162935b80d"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "292980002805162935140108074727801129670365336900000103ffff000082fc0000001e78091b000000360d"))));
+ verifyPosition(decoder, binary(
+ "292980002805162935140108074727801129670365336900000103ffff000082fc0000001e78091b000000360d"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "29298100280A9F9538081228160131022394301140372500000330FF0000007FFC0F00001E000000000034290D"))));
+ verifyPosition(decoder, binary(
+ "29298100280A9F9538081228160131022394301140372500000330FF0000007FFC0F00001E000000000034290D"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "29298000280A81850A120310095750005281370061190800000232F848FFBBFFFF0000001E000000000000ED0D"))));
+ verifyPosition(decoder, binary(
+ "29298000280A81850A120310095750005281370061190800000232F848FFBBFFFF0000001E000000000000ED0D"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "29298E00280F80815A121218203116022318461140227000720262FB00077C7FBF5600001E3C3200000000850D"))));
+ verifyPosition(decoder, binary(
+ "29298E00280F80815A121218203116022318461140227000720262FB00077C7FBF5600001E3C3200000000850D"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "29298200230AA2CC391205030505220285947903109550008002078400000002000000000000750D"))));
+ verifyPosition(decoder, binary(
+ "29298200230AA2CC391205030505220285947903109550008002078400000002000000000000750D"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "29298500081DD08C22120312174026026545710312541700000000F819C839FFFF1D00001E00500000003AF90D"))));
+ verifyPosition(decoder, binary(
+ "29298500081DD08C22120312174026026545710312541700000000F819C839FFFF1D00001E00500000003AF90D"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "292980002822836665140825142037045343770193879200000050ffff000082fc000004b0780b170000002a0d"))));
+ verifyPosition(decoder, binary(
+ "292980002822836665140825142037045343770193879200000050ffff000082fc000004b0780b170000002a0d"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "292980002802425349120811032137022373011140211100000334FFFF000082FC0000001E780913000034DF0D"))));
+ verifyPosition(decoder, binary(
+ "292980002802425349120811032137022373011140211100000334FFFF000082FC0000001E780913000034DF0D"));
}
diff --git a/test/org/traccar/protocol/LaipacProtocolDecoderTest.java b/test/org/traccar/protocol/LaipacProtocolDecoderTest.java
index 62ca2fc1c..1c5c05476 100644
--- a/test/org/traccar/protocol/LaipacProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/LaipacProtocolDecoderTest.java
@@ -1,8 +1,7 @@
package org.traccar.protocol;
-import static org.traccar.helper.DecoderVerifier.verify;
-import static org.junit.Assert.assertNull;
import org.junit.Test;
+import org.traccar.ProtocolDecoderTest;
public class LaipacProtocolDecoderTest extends ProtocolDecoderTest {
@@ -11,77 +10,77 @@ public class LaipacProtocolDecoderTest extends ProtocolDecoderTest {
LaipacProtocolDecoder decoder = new LaipacProtocolDecoder(new LaipacProtocol());
- assertNull(decoder.decode(null, null, "$AVSYS,99999999,V1.50,SN0000103,32768*15"));
+ verifyNothing(decoder, text( "$AVSYS,99999999,V1.50,SN0000103,32768*15"));
- assertNull(decoder.decode(null, null, "$ECHK,99999999,0*35"));
+ verifyNothing(decoder, text( "$ECHK,99999999,0*35"));
- assertNull(decoder.decode(null, null, "$AVSYS,MSG00002,14406,7046811160,64*1A"));
+ verifyNothing(decoder, text( "$AVSYS,MSG00002,14406,7046811160,64*1A"));
- assertNull(decoder.decode(null, null, "$EAVSYS,MSG00002,8931086013104404999,,Owner,0x52014406*76"));
+ verifyNothing(decoder, text( "$EAVSYS,MSG00002,8931086013104404999,,Owner,0x52014406*76"));
- assertNull(decoder.decode(null, null, "$ECHK,MSG00002,0*5E"));
+ verifyNothing(decoder, text( "$ECHK,MSG00002,0*5E"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"$AVRMC,99999999,164339,A,4351.0542,N,07923.5445,W,0.29,78.66,180703,0,3.727,17,1,0,0*37"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"$AVRMC,99999999,164339,a,4351.0542,N,07923.5445,W,0.29,78.66,180703,0,3.727,17,1,0,0*17"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"$AVRMC,99999999,164339,v,4351.0542,N,07923.5445,W,0.29,78.66,180703,0,3.727,17,1,0,0*00"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"$AVRMC,99999999,164339,r,4351.0542,N,07923.5445,W,0.29,78.66,180703,0,3.727,17,1,0,0*04"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"$AVRMC,99999999,164339,A,4351.0542,N,07923.5445,W,0.29,78.66,180703,S,3.727,17,1,0,0*54"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"$AVRMC,99999999,164339,A,4351.0542,N,07923.5445,W,0.29,78.66,180703,T,3.727,17,1,0,0*53"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"$AVRMC,99999999,164339,A,4351.0542,N,07923.5445,W,0.29,78.66,180703,3,3.727,17,1,0,0*34"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"$AVRMC,99999999,164339,A,4351.0542,N,07923.5445,W,0.29,78.66,180703,X,3.727,17,1,0,0*5F"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"$AVRMC,99999999,164339,A,4351.0542,N,07923.5445,W,0.29,78.66,180703,4,3.727,17,1,0,0*33"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"$AVRMC,MSG00002,003016,v,0000.0000,N,00000.0000,E,0.00,0.00,200614,0,3804,167,1,0,0,0D7AB913,020408*23"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"$AVRMC,MSG00002,003049,V,0000.0000,N,00000.0000,E,0.00,0.00,200614,H,3804,167,1,0,0,0D7AB913,020408*71"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"$AVRMC,MSG00002,041942,V,0000.0000,N,00000.0000,E,0.00,0.00,200614,H,4115,167,1,0,0*0E"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"$AVRMC,MSG00002,043703,V,0000.0000,N,00000.0000,E,0.00,0.00,200614,H,4115,167,1,0,0*07"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"$AVRMC,MSG00002,043750,V,0000.0000,N,00000.0000,E,0.00,0.00,200614,H,4115,167,1,0,0*01"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"$AVRMC,MSG00002,124022,V,0000.0000,N,00000.0000,E,0.00,0.00,240614,3,4076,167,1,0,0,0D7AB913,020408*0D"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"$AVRMC,MSG00002,124058,A,5053.0447,N,00557.8549,E,0.45,65.06,240614,0,4037,167,1,0,0,0D7AB913,020408*26"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"$AVRMC,MSG00002,124144,A,5053.0450,N,00557.8544,E,0.00,65.06,240614,3,4076,167,1,0,0,0D7AB913,020408*26"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"$AVRMC,MSG00002,125142,R,5053.0442,N,00557.8694,E,1.21,40.90,240614,0,4037,167,1,0,0,0D7AB913,020408*33"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"$AVRMC,MSG00002,125517,R,5053.0442,N,00557.8694,E,0.00,0.00,240614,H,4076,167,1,0,0,0D7AB913,020408*75"));
- /*verify(decoder.decode(null, null,
+ /*verifyPosition(decoder, text(
"$AVRMC,MSG00002,043104,p,5114.4664,N,00534.3308,E,0.00,0.00,280614,0,4115,495,1,0,0,0D48C3DC,020408*52"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"$AVRMC,MSG00002,050601,P,5114.4751,N,00534.3175,E,0.00,0.00,280614,0,4115,495,1,0,0,0D48C3DC,020408*7D"));*/
}
diff --git a/test/org/traccar/protocol/M2mProtocolDecoderTest.java b/test/org/traccar/protocol/M2mProtocolDecoderTest.java
index fe6398f32..0f2c3c370 100644
--- a/test/org/traccar/protocol/M2mProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/M2mProtocolDecoderTest.java
@@ -1,9 +1,9 @@
package org.traccar.protocol;
import org.jboss.netty.buffer.ChannelBuffers;
-import static org.traccar.helper.DecoderVerifier.verify;
-import static org.junit.Assert.assertNull;
+
import org.junit.Test;
+import org.traccar.ProtocolDecoderTest;
import org.traccar.helper.ChannelBufferTools;
public class M2mProtocolDecoderTest extends ProtocolDecoderTest {
@@ -13,11 +13,11 @@ public class M2mProtocolDecoderTest extends ProtocolDecoderTest {
M2mProtocolDecoder decoder = new M2mProtocolDecoder(new M2mProtocol());
- assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "235A3C2A2624215C287D70212A21254C7C6421220B0B0B"))));
+ verifyNothing(decoder, binary(
+ "235A3C2A2624215C287D70212A21254C7C6421220B0B0B"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "A6E12C2AAADA4628326B2059576E30202A2FE85D20200B"))));
+ verifyPosition(decoder, binary(
+ "A6E12C2AAADA4628326B2059576E30202A2FE85D20200B"));
}
diff --git a/test/org/traccar/protocol/ManPowerProtocolDecoderTest.java b/test/org/traccar/protocol/ManPowerProtocolDecoderTest.java
index 2101e7709..3d5d28698 100644
--- a/test/org/traccar/protocol/ManPowerProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/ManPowerProtocolDecoderTest.java
@@ -1,7 +1,7 @@
package org.traccar.protocol;
-import static org.traccar.helper.DecoderVerifier.verify;
import org.junit.Test;
+import org.traccar.ProtocolDecoderTest;
public class ManPowerProtocolDecoderTest extends ProtocolDecoderTest {
@@ -10,13 +10,13 @@ public class ManPowerProtocolDecoderTest extends ProtocolDecoderTest {
ManPowerProtocolDecoder decoder = new ManPowerProtocolDecoder(new ManPowerProtocol());
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"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,"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"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,"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"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 ece6b6642..4ccf2a7e0 100644
--- a/test/org/traccar/protocol/MegastekProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/MegastekProtocolDecoderTest.java
@@ -1,7 +1,7 @@
package org.traccar.protocol;
import org.junit.Test;
-import static org.traccar.helper.DecoderVerifier.verify;
+import org.traccar.ProtocolDecoderTest;
public class MegastekProtocolDecoderTest extends ProtocolDecoderTest {
@@ -10,49 +10,49 @@ public class MegastekProtocolDecoderTest extends ProtocolDecoderTest {
MegastekProtocolDecoder decoder = new MegastekProtocolDecoder(new MegastekProtocol());
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"$MGV002,860719020193193,DeviceName,R,240214,104742,A,2238.20471,N,11401.97967,E,00,03,00,1.20,0.462,356.23,137.9,1.5,460,07,262C,0F54,25,0000,0000,0,0,0,28.5,28.3,,,100,Timer;!"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"STX2010101801 j$GPRMC,101053.000,A,2232.7607,N,11404.7669,E,0.00,,231110,,,A*7F,460,00,2795,0E6A,14,94,1000,0000,91,Timer;1D"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"STX,861001005215757,$GPRMC,180118.000,A,4241.330116,N,2321.931251,E,0.00,182.19,130915,,E,A,F,Nil-Alarms,imei:861001005215757,8,577.0,Battery=38%,0,284,03,03E8,3139;7A"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"STX,865067020439090,$GPRMC,171013.000,A,5919.1411,N,01804.1681,E,0.000,294.41,140815,,,A"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"$MGV002,013777007536434,,R,010114,000057,V,0000.0000,N,00000.0000,E,00,00,00,99.9,0.000,0.00,0.0,80.263,510,89,2342,030B,,0000,0000,200,96,0, , ,,,,Timer;!"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"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"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"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"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"STX,,$GPRMC,001339.000,A,4710.85395,N,02733.58209,E,1.65,238.00,010109,,,A*67,L,Help,imei:013227009737796,0/8,137.1,Battery=100%,,0,226,01,2B9B,BBBF;8D"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"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"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"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"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"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"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"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;"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"LOGSTX,123456789012345,$GPRMC,225419.000,A,3841.82201,N,09494.73357,W,12.46,135.33,270914,,,A*47,F,,imei:123456789012345,0/6,,Battery=100%,,0,,,5856,78A3;24"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"LOGSTX,123456789012345,$GPRMC,230551.000,A,3841.81956,N,09494.45403,W,0.00,0.00,270914,,,A*7C,L,,imei:123456789012345,0/7,269.7,Battery=100%,,0,,,5856,78A3;83"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"LOGSTX,123456789012345,$GPRMC,230739.000,A,3841.81895,N,09494.12409,W,0.00,0.00,270914,,,A*70,L,,imei:123456789012345,0/7,269.7,Battery=100%,,0,,,5856,78A3;78"));
}
diff --git a/test/org/traccar/protocol/MeiligaoProtocolDecoderTest.java b/test/org/traccar/protocol/MeiligaoProtocolDecoderTest.java
index f48c9ef39..523679201 100644
--- a/test/org/traccar/protocol/MeiligaoProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/MeiligaoProtocolDecoderTest.java
@@ -1,10 +1,9 @@
package org.traccar.protocol;
import org.jboss.netty.buffer.ChannelBuffers;
-import static org.junit.Assert.assertNull;
import org.junit.Test;
+import org.traccar.ProtocolDecoderTest;
import org.traccar.helper.ChannelBufferTools;
-import static org.traccar.helper.DecoderVerifier.verify;
public class MeiligaoProtocolDecoderTest extends ProtocolDecoderTest {
@@ -13,77 +12,77 @@ public class MeiligaoProtocolDecoderTest extends ProtocolDecoderTest {
MeiligaoProtocolDecoder decoder = new MeiligaoProtocolDecoder(new MeiligaoProtocol());
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "242400706796502079108999553131333131382e3030302c412c313033372e393637382c4e2c30363132312e353637392c572c302e35342c322e34322c3330303931352c2c2c412a37307c302e37377c392e397c303030307c303030302c303161327c3030313138373132374cae0d0a"))));
+ verifyPosition(decoder, binary(
+ "242400706796502079108999553131333131382e3030302c412c313033372e393637382c4e2c30363132312e353637392c572c302e35342c322e34322c3330303931352c2c2c412a37307c302e37377c392e397c303030307c303030302c303161327c3030313138373132374cae0d0a"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "24240074630700194707719966009E1F7F00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007C3132303334302C3238303630362C323430302E303030302C4E2C31323130302E303030302C458F7E0D0A"))));
+ verifyPosition(decoder, binary(
+ "24240074630700194707719966009E1F7F00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007C3132303334302C3238303630362C323430302E303030302C4E2C31323130302E303030302C458F7E0D0A"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "24240076220720151fffff99660012b3ab00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007c3135303634382c3233303731352c313931352e37323835362c4e2c30373235322e35333034342c456dd00d0a"))));
+ verifyPosition(decoder, binary(
+ "24240076220720151fffff99660012b3ab00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007c3135303634382c3233303731352c313931352e37323835362c4e2c30373235322e35333034342c456dd00d0a"));
- assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "24240000123456FFFFFFFF50008B9B0D0A"))));
+ verifyNothing(decoder, binary(
+ "24240000123456FFFFFFFF50008B9B0D0A"));
- assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "24240011300600000046090002849a0d0a"))));
+ verifyNothing(decoder, binary(
+ "24240011300600000046090002849a0d0a"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "242400722015032700004299553134313131352e3030302c412c353031312e343335342c4e2c30303834332e373039322c452c3030302e302c3034342e362c3134303431352c2c2c412a36437c322e317c39392e347c303030307c303030302c303030307c3030303032343730350e480d0a"))));
+ verifyPosition(decoder, binary(
+ "242400722015032700004299553134313131352e3030302c412c353031312e343335342c4e2c30303834332e373039322c452c3030302e302c3034342e362c3134303431352c2c2c412a36437c322e317c39392e347c303030307c303030302c303030307c3030303032343730350e480d0a"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "2424006e241120141fffff99553039333931302e30302c412c313931342e37373736352c4e2c30373235302e36383037322c452c302e3035312c2c3230313231342c2c2c442a37357c302e38327c322e387c303030307c303030302c303030307c3031303833373433311d170d0a"))));
+ verifyPosition(decoder, binary(
+ "2424006e241120141fffff99553039333931302e30302c412c313931342e37373736352c4e2c30373235302e36383037322c452c302e3035312c2c3230313231342c2c2c442a37357c302e38327c322e387c303030307c303030302c303030307c3031303833373433311d170d0a"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "24240000123456FFFFFFFF99553033353634342E3030302C412C323233322E363038332C4E2C31313430342E383133372C452C302E30302C2C3031303830392C2C2A31437C31312E357C3139347C303030307C303030302C3030303069620D0A"))));
+ verifyPosition(decoder, binary(
+ "24240000123456FFFFFFFF99553033353634342E3030302C412C323233322E363038332C4E2C31313430342E383133372C452C302E30302C2C3031303830392C2C2A31437C31312E357C3139347C303030307C303030302C3030303069620D0A"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "242400003358019703581F99553133343335312E3030302C412C303932352E353032352C4E2C30363931342E383130372C572C302E30302C32332C3330313031322C2C2A32437C302E387C3138367C323030307C303132362C303046467C303244453030303244384344423431357C30367C303046443642373995820D0A"))));
+ verifyPosition(decoder, binary(
+ "242400003358019703581F99553133343335312E3030302C412C303932352E353032352C4E2C30363931342E383130372C572C302E30302C32332C3330313031322C2C2A32437C302E387C3138367C323030307C303132362C303046467C303244453030303244384344423431357C30367C303046443642373995820D0A"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "242400001691000484124F99553134303630332E3030302C412C303933342E323535342C4E2C30363931332E303936362C572C302E30302C2C3330313031322C2C2A30327C302E387C3230377C30303030FA420D0A"))));
+ verifyPosition(decoder, binary(
+ "242400001691000484124F99553134303630332E3030302C412C303933342E323535342C4E2C30363931332E303936362C572C302E30302C2C3330313031322C2C2A30327C302E387C3230377C30303030FA420D0A"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "2424000045124220306FFF9999143135353432322E3030302C562C323233302E373632332C4E2C31313430332E343231382C452C302E30302C302C3036303231312C2C2A31417C302E307C32367C303030307C303030302C303030307C303030303030303030303030303030307C36337C3030303030303030BAC10D0A"))));
+ verifyPosition(decoder, binary(
+ "2424000045124220306FFF9999143135353432322E3030302C562C323233302E373632332C4E2C31313430332E343231382C452C302E30302C302C3036303231312C2C2A31417C302E307C32367C303030307C303030302C303030307C303030303030303030303030303030307C36337C3030303030303030BAC10D0A"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "242400008621700142458F9999503139323935382E3030302C412C333632372E313639392C4E2C30313034332E353632372C452C302E30302C3233392C3039313231322C2C2A30467C312E307C377C303030307C303141392C303139377C303235443030303230303541383639467C31327C3030303333424233E2480D0A"))));
+ verifyPosition(decoder, binary(
+ "242400008621700142458F9999503139323935382E3030302C412C333632372E313639392C4E2C30313034332E353632372C452C302E30302C3233392C3039313231322C2C2A30467C312E307C377C303030307C303141392C303139377C303235443030303230303541383639467C31327C3030303333424233E2480D0A"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "24240000123456789FFFFF99553032303630302E3933302C412C323330392E323035312C4E2C31313331382E383434392C452C302E30302C302E30302C3039303731302C2C2C412A36417C322E367C39362E377C303030307C303030302C334646467C303030303030303030C4520D0A"))));
+ verifyPosition(decoder, binary(
+ "24240000123456789FFFFF99553032303630302E3933302C412C323330392E323035312C4E2C31313331382E383434392C452C302E30302C302E30302C3039303731302C2C2C412A36417C322E367C39362E377C303030307C303030302C334646467C303030303030303030C4520D0A"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "242400005977203744058499553032303131372E3030302C412C343131372E393231322C4E2C30383133302E323039362C572C302E30302C3330332E38352C3236303231337C312E367C30307C303030307C303030302C3030303071CD0D0A"))));
+ verifyPosition(decoder, binary(
+ "242400005977203744058499553032303131372E3030302C412C343131372E393231322C4E2C30383133302E323039362C572C302E30302C3330332E38352C3236303231337C312E367C30307C303030307C303030302C3030303071CD0D0A"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "242400003511111111111199553133343734332e3030332c412c303634382e393836362c532c31303730372e353739352c452c3030302e302c3030302e302c323630333133f3150d0a"))));
+ verifyPosition(decoder, binary(
+ "242400003511111111111199553133343734332e3030332c412c303634382e393836362c532c31303730372e353739352c452c3030302e302c3030302e302c323630333133f3150d0a"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "242400000091800369764199553038353133302e3030302c412c333035332e313634352c4e2c30373535352e373437362c452c302e30302c32372c3136303431332c2c2a33467c302e387c3234357c323030307c303346372c303030302c303030302c303031422c303030302c303030302c303030302c303030307c303139343030303230314343363237437c31417c3031313630383439e6a70d0a"))));
+ verifyPosition(decoder, binary(
+ "242400000091800369764199553038353133302e3030302c412c333035332e313634352c4e2c30373535352e373437362c452c302e30302c32372c3136303431332c2c2a33467c302e387c3234357c323030307c303346372c303030302c303030302c303031422c303030302c303030302c303030302c303030307c303139343030303230314343363237437c31417c3031313630383439e6a70d0a"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "2424000026016100901fff99553136353835332c412c343130392e36303231322c4e2c3833382e35393131392c572c332e3838332c31322e30302c3034303731332c2c2a34467c322e357c3131307c000600007c0000010f7c303242302c3042333697740d0a"))));
+ verifyPosition(decoder, binary(
+ "2424000026016100901fff99553136353835332c412c343130392e36303231322c4e2c3833382e35393131392c572c332e3838332c31322e30302c3034303731332c2c2a34467c322e357c3131307c000600007c0000010f7c303242302c3042333697740d0a"));
- assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "2424000067622010053562aa0000010001ae4f00000007800000003039353135362e3030302c412c323632332e383936362c4e2c30353030352e303638302c452c32342e352c3234312e302c323231303133599c0d0a"))));
+ verifyNothing(decoder, binary(
+ "2424000067622010053562aa0000010001ae4f00000007800000003039353135362e3030302c412c323632332e383936362c4e2c30353030352e303638302c452c32342e352c3234312e302c323231303133599c0d0a"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "242400001007ffffffffff99553136323330392e3035342c562c303933312e393136332c4e2c30363931312e383233332c572c2c2c3235313131332c2c2c4e2a36437c7c3135387c303030309cc60d0a"))));
+ verifyPosition(decoder, binary(
+ "242400001007ffffffffff99553136323330392e3035342c562c303933312e393136332c4e2c30363931312e383233332c572c2c2c3235313131332c2c2c4e2a36437c7c3135387c303030309cc60d0a"));
- //verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- // "242400003563070435652099553035323034322e3030302c412c343435382e333536352c4e2c30343130342e343831332c452c302e30302c302e30302c3139303131342c2c2a39437c302e3730303030307c2d3835393131373337367c303130307c307c7c7c4f2a0d0a"))));
+ //verifyPosition(decoder, binary(
+ // "242400003563070435652099553035323034322e3030302c412c343435382e333536352c4e2c30343130342e343831332c452c302e30302c302e30302c3139303131342c2c2a39437c302e3730303030307c2d3835393131373337367c303130307c307c7c7c4f2a0d0a"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "2424005035784251ffffff99553030303033362e3938312c562c303933312e333437312c4e2c30363931312e383431322c572c2c2c3238303131342c2c2c4e2a36357c7c3136387c323030305e420d0a"))));
+ verifyPosition(decoder, binary(
+ "2424005035784251ffffff99553030303033362e3938312c562c303933312e333437312c4e2c30363931312e383431322c572c2c2c3238303131342c2c2c4e2a36357c7c3136387c323030305e420d0a"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "2424007811223344ffffff99553031303735372e3030302c412c323935392e313337342c4e2c30393534302e333238342c572c3030302e302c3038382e372c3234303631342c2c2c412a37397c312e347c33352e317c303030307c303030312c303030307c3030303030333732337c3030303030e39f0d0a"))));
+ verifyPosition(decoder, binary(
+ "2424007811223344ffffff99553031303735372e3030302c412c323935392e313337342c4e2c30393534302e333238342c572c3030302e302c3038382e372c3234303631342c2c2c412a37397c312e347c33352e317c303030307c303030312c303030307c3030303030333732337c3030303030e39f0d0a"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "2424007f3568960306760199553131303932342e3030302c412c343533342e323538352c4e2c30313933382e363531342c452c302e30302c2c3237303731342c2c2c412a37317c312e377c3130307c383030307c303737422c303030302c303030302c303030302c303030302c303030302c303030302c303030305dfc0d0a"))));
+ verifyPosition(decoder, binary(
+ "2424007f3568960306760199553131303932342e3030302c412c343533342e323538352c4e2c30313933382e363531342c452c302e30302c2c3237303731342c2c2c412a37317c312e377c3130307c383030307c303737422c303030302c303030302c303030302c303030302c303030302c303030302c303030305dfc0d0a"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "2424007f2015603256ffff99553230303230392e30302c412c313734342e36393434382c4e2c30383331392e30353537302c452c31302e3236322c3234382e35352c3236303631352c2c2c442a35437c302e39397c33312e397c303830317c303030302c303030637c3030303933303131367c3030376165313035d5550d0a"))));
+ verifyPosition(decoder, binary(
+ "2424007f2015603256ffff99553230303230392e30302c412c313734342e36393434382c4e2c30383331392e30353537302c452c31302e3236322c3234382e35352c3236303631352c2c2c442a35437c302e39397c33312e397c303830317c303030302c303030637c3030303933303131367c3030376165313035d5550d0a"));
}
diff --git a/test/org/traccar/protocol/MeitrackProtocolDecoderTest.java b/test/org/traccar/protocol/MeitrackProtocolDecoderTest.java
index 426244144..2c513272c 100644
--- a/test/org/traccar/protocol/MeitrackProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/MeitrackProtocolDecoderTest.java
@@ -1,11 +1,8 @@
package org.traccar.protocol;
import java.nio.ByteOrder;
-import java.nio.charset.Charset;
-import org.jboss.netty.buffer.ChannelBuffers;
import org.junit.Test;
-import org.traccar.helper.ChannelBufferTools;
-import static org.traccar.helper.DecoderVerifier.verify;
+import org.traccar.ProtocolDecoderTest;
public class MeitrackProtocolDecoderTest extends ProtocolDecoderTest {
@@ -14,65 +11,65 @@ public class MeitrackProtocolDecoderTest extends ProtocolDecoderTest {
MeitrackProtocolDecoder decoder = new MeitrackProtocolDecoder(new MeitrackProtocol());
- verify(decoder.decode(null, null, ChannelBuffers.copiedBuffer(
- "$$A158,79007001520234,AAA,35,40.996370,-8.575065,150730184834,A,8,24,0,1,1.3,173,32573389,31405012,268|3|2BC0|250B,2000,|||0A2D|0000,00000001,,50,,,,,,,,,,,,,*4A", Charset.defaultCharset())));
+ verifyPosition(decoder, buffer(
+ "$$A158,79007001520234,AAA,35,40.996370,-8.575065,150730184834,A,8,24,0,1,1.3,173,32573389,31405012,268|3|2BC0|250B,2000,|||0A2D|0000,00000001,,50,,,,,,,,,,,,,*4A"));
- verify(decoder.decode(null, null, ChannelBuffers.copiedBuffer(
- "$$G145,862106024274815,AAA,35,-1.287125,36.906061,150530054639,A,10,13,12,67,0.8,1621,38359791,42330881,639|2|FB2|2F3,0000,3|0|0|A58|432,,,1,0009,*26", Charset.defaultCharset())));
+ verifyPosition(decoder, buffer(
+ "$$G145,862106024274815,AAA,35,-1.287125,36.906061,150530054639,A,10,13,12,67,0.8,1621,38359791,42330881,639|2|FB2|2F3,0000,3|0|0|A58|432,,,1,0009,*26"));
- verify(decoder.decode(null, null, ChannelBuffers.copiedBuffer(
- "$$I152,013949004569813,AAA,37,54.739468,25.273648,150208173414,A,5,24,0,73,1.5,165,74,3381,246|1|0065|118A,0000,0003|0003|0000|08D4|0002,006380DF,,1,0008*7C", Charset.defaultCharset())));
+ verifyPosition(decoder, buffer(
+ "$$I152,013949004569813,AAA,37,54.739468,25.273648,150208173414,A,5,24,0,73,1.5,165,74,3381,246|1|0065|118A,0000,0003|0003|0000|08D4|0002,006380DF,,1,0008*7C"));
- verify(decoder.decode(null, null, ChannelBuffers.copiedBuffer(
- "$$E141,863071013799553,AAA,35,-1.264521,36.801128,150307132846,A,11,20,0.2,0,5,1767,84045888,36496633,639|02|100E|844,1234,0018|||025D|00CB,*17", Charset.defaultCharset())));
+ verifyPosition(decoder, buffer(
+ "$$E141,863071013799553,AAA,35,-1.264521,36.801128,150307132846,A,11,20,0.2,0,5,1767,84045888,36496633,639|02|100E|844,1234,0018|||025D|00CB,*17"));
- verify(decoder.decode(null, null, ChannelBuffers.copiedBuffer(
- "$$m140,013777008931857,AAA,1,54.739580,25.273263,141120144603,V,0,25,0,6,50.0,159,19825,13940,246|1|0065|118A,0100,0000|0000|0000|092A|0001,,*1C", Charset.defaultCharset())));
+ verifyPosition(decoder, buffer(
+ "$$m140,013777008931857,AAA,1,54.739580,25.273263,141120144603,V,0,25,0,6,50.0,159,19825,13940,246|1|0065|118A,0100,0000|0000|0000|092A|0001,,*1C"));
- verify(decoder.decode(null, null, ChannelBuffers.copiedBuffer(
- "$$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", Charset.defaultCharset())));
+ verifyPosition(decoder, buffer(
+ "$$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"));
- verify(decoder.decode(null, null, ChannelBuffers.copiedBuffer(
- "$$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", Charset.defaultCharset())));
+ verifyPosition(decoder, buffer(
+ "$$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"));
- verify(decoder.decode(null, null, ChannelBuffers.copiedBuffer(
- "$$]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", Charset.defaultCharset())));
+ verifyPosition(decoder, buffer(
+ "$$]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"));
- verify(decoder.decode(null, null, ChannelBuffers.copiedBuffer(
- "$$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", Charset.defaultCharset())));
+ verifyPosition(decoder, buffer(
+ "$$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"));
- verify(decoder.decode(null, null, ChannelBuffers.copiedBuffer(
- "$$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", Charset.defaultCharset())));
+ verifyPosition(decoder, buffer(
+ "$$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"));
- verify(decoder.decode(null, null, ChannelBuffers.copiedBuffer(
- "$$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", Charset.defaultCharset())));
+ verifyPosition(decoder, buffer(
+ "$$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"));
- verify(decoder.decode(null, null, ChannelBuffers.copiedBuffer(
- "$$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", Charset.defaultCharset())));
+ verifyPosition(decoder, buffer(
+ "$$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"));
- verify(decoder.decode(null, null, ChannelBuffers.copiedBuffer(
- "$$_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", Charset.defaultCharset())));
+ verifyPosition(decoder, buffer(
+ "$$_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"));
- verify(decoder.decode(null, null, ChannelBuffers.copiedBuffer(
- "$$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", Charset.defaultCharset())));
+ verifyPosition(decoder, buffer(
+ "$$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"));
- verify(decoder.decode(null, null, ChannelBuffers.copiedBuffer(
- "$$E150,013777001165479,AAA,35,10.296601,123.872115,140501161505,A,4,22,1,170,1.4,77,39097,393563,515|3|A0CC|ED96,0000,0008|0003|0000|09D5|0000,,,1,0009*1E", Charset.defaultCharset())));
+ verifyPosition(decoder, buffer(
+ "$$E150,013777001165479,AAA,35,10.296601,123.872115,140501161505,A,4,22,1,170,1.4,77,39097,393563,515|3|A0CC|ED96,0000,0008|0003|0000|09D5|0000,,,1,0009*1E"));
- verify(decoder.decode(null, null, ChannelBuffers.copiedBuffer(
- "$$B140,013777001293701,AAA,35,-7.266760,112.743550,140521095314,A,3,22,0,275,2.7,45,1984,8059,510|1|3504|EBFE,0000,0000|0000|0000|0914|0002,,*F9\r\n", Charset.defaultCharset())));
+ verifyPosition(decoder, buffer(
+ "$$B140,013777001293701,AAA,35,-7.266760,112.743550,140521095314,A,3,22,0,275,2.7,45,1984,8059,510|1|3504|EBFE,0000,0000|0000|0000|0914|0002,,*F9\r\n"));
- verify(decoder.decode(null, null, ChannelBuffers.copiedBuffer(
- "$$J163,123123123123123,AFF,0004,35,58.588926,16.180473,140928192856,A,10,27,0,161,1.2,19,1648894,435695,240|24|88B9|E435,0000,|||0A22|0000,00000001,,50,,,,,,,,,,,,,*70\r\n", Charset.defaultCharset())));
+ verifyPosition(decoder, buffer(
+ "$$J163,123123123123123,AFF,0004,35,58.588926,16.180473,140928192856,A,10,27,0,161,1.2,19,1648894,435695,240|24|88B9|E435,0000,|||0A22|0000,00000001,,50,,,,,,,,,,,,,*70\r\n"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString(
- "24245838362c3336393830303031343039303032312c4343432c020134000100000023381f91ffe354b806c5e3121b0009130000000000000000d33801007cbf0200fe0101000435feeb02000500a3010000000000002a62650d0a"))));
+ verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ "24245838362c3336393830303031343039303032312c4343432c020134000100000023381f91ffe354b806c5e3121b0009130000000000000000d33801007cbf0200fe0101000435feeb02000500a3010000000000002a62650d0a"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString(
- "2424473937302c3336393830303031333436303637342c4343432c020134005b000000010ce304035db9e000ec6f591a000013000000000c001801edb70200c96d0100e60001004838576501000300a101c20400000000010ce304035db9e000ee6f591a000013000000000c001801edb70200ca6d0100e60001004838576501000300a101c20400000000010ce304035db9e000ef6f591a000013000000000c001801edb70200cc6d0100e60001004838576501000300a101c20400000000020ce304035db9e000f76f591a000016000000000c001801edb70200d36d0100e60001004838576502000300a101bf04000000000a0ce304035db9e000f76f591a000016000000000c001801edb70200d46d0100e60001004838576500000300a101bf0400000000020ce304035db9e000fb6f591a000016000000000c001801edb70200d86d0100e60001004838576502000300a101760400000000180ce304035db9e000fc6f591a0000120000000000008c00edb70200d96d0100e60001004838576502000300a10176040000000019b1e2040323b9e0000b70591a0105150600bb0012002901edb70200e76d0100e60001004838576502000300a2017005000000002023e304031fb9e0001070591a010615070027010d001601fcb70200ec6d0100e60001004838576502000300a201800500000000201fe3040302b9e0001170591a010615090019010d001501feb70200ed6d0100e60001004838576502000300a2018005000000002018e30403dcb8e0001270591a0106150b0011010d00150100b80200ee6d0100e60001004838576502000300a2018005000000002036e3040345b8e0001570591a0107150b002d010b0013010ab80200f16d0100e60001004838576502000300a2018005000000002053e3040326b8e0001670591a0107150d0041010b0013010eb80200f26d0100e60001004838576502000300a2018005000000002070e3040310b8e0001770591a0107150e004f010b00130111b80200f36d0100e60001004838576502000300a2018005000000002095e3040306b8e0001870591a0107150d005a010b00140115b80200f46d0100e60001004838576502000300a20180050000000020b3e3040305b8e0001970591a0107150b0060010b00140118b80200f56d0100e60001004838576502000300a20183050000000020cfe3040308b8e0001a70591a0107150b0066010b0014011bb80200f66d0100e60001004838576502000300a20183050000000020eee304030cb8e0001b70591a0106170b0004000d0014011eb80200f76d0100e60001004838576502000300a2018305000000002a62350d0a"))));
+ verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ "2424473937302c3336393830303031333436303637342c4343432c020134005b000000010ce304035db9e000ec6f591a000013000000000c001801edb70200c96d0100e60001004838576501000300a101c20400000000010ce304035db9e000ee6f591a000013000000000c001801edb70200ca6d0100e60001004838576501000300a101c20400000000010ce304035db9e000ef6f591a000013000000000c001801edb70200cc6d0100e60001004838576501000300a101c20400000000020ce304035db9e000f76f591a000016000000000c001801edb70200d36d0100e60001004838576502000300a101bf04000000000a0ce304035db9e000f76f591a000016000000000c001801edb70200d46d0100e60001004838576500000300a101bf0400000000020ce304035db9e000fb6f591a000016000000000c001801edb70200d86d0100e60001004838576502000300a101760400000000180ce304035db9e000fc6f591a0000120000000000008c00edb70200d96d0100e60001004838576502000300a10176040000000019b1e2040323b9e0000b70591a0105150600bb0012002901edb70200e76d0100e60001004838576502000300a2017005000000002023e304031fb9e0001070591a010615070027010d001601fcb70200ec6d0100e60001004838576502000300a201800500000000201fe3040302b9e0001170591a010615090019010d001501feb70200ed6d0100e60001004838576502000300a2018005000000002018e30403dcb8e0001270591a0106150b0011010d00150100b80200ee6d0100e60001004838576502000300a2018005000000002036e3040345b8e0001570591a0107150b002d010b0013010ab80200f16d0100e60001004838576502000300a2018005000000002053e3040326b8e0001670591a0107150d0041010b0013010eb80200f26d0100e60001004838576502000300a2018005000000002070e3040310b8e0001770591a0107150e004f010b00130111b80200f36d0100e60001004838576502000300a2018005000000002095e3040306b8e0001870591a0107150d005a010b00140115b80200f46d0100e60001004838576502000300a20180050000000020b3e3040305b8e0001970591a0107150b0060010b00140118b80200f56d0100e60001004838576502000300a20183050000000020cfe3040308b8e0001a70591a0107150b0066010b0014011bb80200f66d0100e60001004838576502000300a20183050000000020eee304030cb8e0001b70591a0106170b0004000d0014011eb80200f76d0100e60001004838576502000300a2018305000000002a62350d0a"));
- //verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString(
- // "2424473937302C3336393830303031333232303032302C4343432C02013400540000001F0E885701225FCC06F574A419000614000000001200280012390C0081080000CC01000062305446000000007901000000000000000000000000000000000000000000008004000080040000800400008004000000000000000000000000000000000000FEEE00001F0E885701225FCC06CD7AA419000614000000001200280012390C00260D0000CC01000062305446000000007801A403000000001F0E885701225FCC06257DA419000617000000001200280012390C007E0F0000CC01000062305446000000007701A403000000001F0E885701225FCC067E7FA419000016000000001200280012390C00D6110000CC01000062305446000000007701A603000000001F0E885701225FCC06D681A419000017000000001200280012390C002E140000CC01000062305446000000007601A603000000001F0E885701225FCC062E84A419000015000000001200280012390C0086160000CC01000062305446000000007501A603000000001F0E885701225FCC067A83A51900060E000000001200280012390C0065190000CC0100006230EAB7000000007301A403000000001F0E885701225FCC06D285A51900060E000000001200280012390C00BD1B0000CC01000062305446000000007101A203000000001F0E885701225FCC062B88A51900060F000000001200280012390C00151E0000CC01000062305446000000007001A203000000001F0E885701225FCC06838AA519000613000000001200280012390C006D200000CC01000062305446000000007001A603000000001F0E885701225FCC06DB8CA519000010000000001200280012390C00C5220000CC01000062305446000000006E01A603000000001F0E885701225FCC06348FA519000016000000001200280012390C001D250000CC01000062305446000000006401000000000000020E885701225FCC06D9D9A519000600000000001200280012390C007828000000000000000000000200000054010000000000001F0E885701225FCC062DDCA519000616000000001200280012390C00CC2A0000CC01000062305446020000007B010000000000000A0E885701225FCC065BDDA519000613000000001200280012390C00F92B0000CC01000062305446000000007C01000000000000020E885701225FCC065CDDA519000010000000001200280012390C00FB2B0000CC01000062305446020000007C010000000000001F0E885701225FCC0685DEA519000013000000001200280012390C00242D0000CC01000062305446020000007D010000000000002A35620D0A"))));
+ //verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ // "2424473937302C3336393830303031333232303032302C4343432C02013400540000001F0E885701225FCC06F574A419000614000000001200280012390C0081080000CC01000062305446000000007901000000000000000000000000000000000000000000008004000080040000800400008004000000000000000000000000000000000000FEEE00001F0E885701225FCC06CD7AA419000614000000001200280012390C00260D0000CC01000062305446000000007801A403000000001F0E885701225FCC06257DA419000617000000001200280012390C007E0F0000CC01000062305446000000007701A403000000001F0E885701225FCC067E7FA419000016000000001200280012390C00D6110000CC01000062305446000000007701A603000000001F0E885701225FCC06D681A419000017000000001200280012390C002E140000CC01000062305446000000007601A603000000001F0E885701225FCC062E84A419000015000000001200280012390C0086160000CC01000062305446000000007501A603000000001F0E885701225FCC067A83A51900060E000000001200280012390C0065190000CC0100006230EAB7000000007301A403000000001F0E885701225FCC06D285A51900060E000000001200280012390C00BD1B0000CC01000062305446000000007101A203000000001F0E885701225FCC062B88A51900060F000000001200280012390C00151E0000CC01000062305446000000007001A203000000001F0E885701225FCC06838AA519000613000000001200280012390C006D200000CC01000062305446000000007001A603000000001F0E885701225FCC06DB8CA519000010000000001200280012390C00C5220000CC01000062305446000000006E01A603000000001F0E885701225FCC06348FA519000016000000001200280012390C001D250000CC01000062305446000000006401000000000000020E885701225FCC06D9D9A519000600000000001200280012390C007828000000000000000000000200000054010000000000001F0E885701225FCC062DDCA519000616000000001200280012390C00CC2A0000CC01000062305446020000007B010000000000000A0E885701225FCC065BDDA519000613000000001200280012390C00F92B0000CC01000062305446000000007C01000000000000020E885701225FCC065CDDA519000010000000001200280012390C00FB2B0000CC01000062305446020000007C010000000000001F0E885701225FCC0685DEA519000013000000001200280012390C00242D0000CC01000062305446020000007D010000000000002A35620D0A"));
}
diff --git a/test/org/traccar/protocol/MiniFinderProtocolDecoderTest.java b/test/org/traccar/protocol/MiniFinderProtocolDecoderTest.java
index 742376fe7..5f6add6c5 100644
--- a/test/org/traccar/protocol/MiniFinderProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/MiniFinderProtocolDecoderTest.java
@@ -1,8 +1,7 @@
package org.traccar.protocol;
-import static org.traccar.helper.DecoderVerifier.verify;
-import static org.junit.Assert.assertNull;
import org.junit.Test;
+import org.traccar.ProtocolDecoderTest;
public class MiniFinderProtocolDecoderTest extends ProtocolDecoderTest {
@@ -11,15 +10,15 @@ public class MiniFinderProtocolDecoderTest extends ProtocolDecoderTest {
MiniFinderProtocolDecoder decoder = new MiniFinderProtocolDecoder(new MiniFinderProtocol());
- assertNull(decoder.decode(null, null, "!1,860719020212696"));
+ verifyNothing(decoder, text( "!1,860719020212696"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"!D,22/2/14,13:40:58,56.899601,14.811541,0,0,1,176.0,98,5,16,0"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"!D,22/2/14,13:47:51,56.899517,14.811665,0,0,b0001,179.3,97,5,16,0"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"!D,3/7/13,6:35:30,22.645952,114.040436,0.0,225.8,1f0001,12.11,98,0,0,0"));
}
diff --git a/test/org/traccar/protocol/MtxProtocolDecoderTest.java b/test/org/traccar/protocol/MtxProtocolDecoderTest.java
index bc597af4d..0cd0400c2 100644
--- a/test/org/traccar/protocol/MtxProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/MtxProtocolDecoderTest.java
@@ -1,8 +1,7 @@
package org.traccar.protocol;
-import static org.traccar.helper.DecoderVerifier.verify;
-
import org.junit.Test;
+import org.traccar.ProtocolDecoderTest;
public class MtxProtocolDecoderTest extends ProtocolDecoderTest {
@@ -11,7 +10,7 @@ public class MtxProtocolDecoderTest extends ProtocolDecoderTest {
MtxProtocolDecoder decoder = new MtxProtocolDecoder(new MtxProtocol());
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"#MTX,353815011138124,20101226,195550,41.6296399,002.3611174,000,035,000000.00,X,X,1111,000,0,0"));
}
diff --git a/test/org/traccar/protocol/MxtProtocolDecoderTest.java b/test/org/traccar/protocol/MxtProtocolDecoderTest.java
index 07e27927e..454e57087 100644
--- a/test/org/traccar/protocol/MxtProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/MxtProtocolDecoderTest.java
@@ -3,8 +3,8 @@ package org.traccar.protocol;
import java.nio.ByteOrder;
import org.jboss.netty.buffer.ChannelBuffers;
import org.junit.Test;
+import org.traccar.ProtocolDecoderTest;
import org.traccar.helper.ChannelBufferTools;
-import static org.traccar.helper.DecoderVerifier.verify;
public class MxtProtocolDecoderTest extends ProtocolDecoderTest {
@@ -13,32 +13,32 @@ public class MxtProtocolDecoderTest extends ProtocolDecoderTest {
MxtProtocolDecoder decoder = new MxtProtocolDecoder(new MxtProtocol());
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString(
- "01a631361e7a00082471418b052a2c46b587ffc01ae3fd000008800000000000003345422203000000f000f00000000000ea1e04"))));
+ verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ "01a631361e7a00082471418b052a2c46b587ffc01ae3fd000008800000000000003345422203000000f000f00000000000ea1e04"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString(
- "01a63118787d00086440628d226e2bc26a97feac8a3afd10210010308000000000000018003d2b10240000005e2f0000f427f21031feff0000593804"))));
+ verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ "01a63118787d00086440628d226e2bc26a97feac8a3afd10210010308000000000000018003d2b10240000005e2f0000f427f21031feff0000593804"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString(
- "01a631bd777d0008646e319e17292ce86798fed4cd3afd102110211030800000102403001f15003e2b102400000034300000f4271021007b175535a7be04"))));
+ verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ "01a631bd777d0008646e319e17292ce86798fed4cd3afd102110211030800000102403001f15003e2b102400000034300000f4271021007b175535a7be04"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString(
- "01a631e3f97e00087cf40a98151c2cc46898fee0ce3afd1021001030c0000006102116072e003829bb00000036102100001024000000062b0000f42730004b06a6384b4304"))));
+ verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ "01a631e3f97e00087cf40a98151c2cc46898fee0ce3afd1021001030c0000006102116072e003829bb00000036102100001024000000062b0000f42730004b06a6384b4304"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString(
- "01a63118787d00086468457a466a2bc26a97feac8a3afd10212010308000000000001fe1053d291024000000922f0000f4271021007b17553599bb04"))));
+ verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ "01a63118787d00086468457a466a2bc26a97feac8a3afd10212010308000000000001fe1053d291024000000922f0000f4271021007b17553599bb04"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString(
- "01a63118787d0008648645ec486a2bc26a97feac8a3afd1021001030c0000000001419eb05372b1024000000982a0000f4271021007b17000010308c04"))));
+ verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ "01a63118787d0008648645ec486a2bc26a97feac8a3afd1021001030c0000000001419eb05372b1024000000982a0000f4271021007b17000010308c04"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString(
- "01a631e3f97e00087cfa0af3151c2c126798febace3afd1021801030c0000006102122082f003e29bb00000037102100001024000000ab2f0000f42730004b060000488c04"))));
+ verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ "01a631e3f97e00087cfa0af3151c2c126798febace3afd1021801030c0000006102122082f003e29bb00000037102100001024000000ab2f0000f42730004b060000488c04"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString(
- "01a631e3f97e00087cfe0a4b161c2c126798febace3afd1021801030800000071021240731003e2abb00000038102100001024000000c12f0000f42730004b06a638633104"))));
+ verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ "01a631e3f97e00087cfe0a4b161c2c126798febace3afd1021801030800000071021240731003e2abb00000038102100001024000000c12f0000f42730004b06a638633104"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString(
- "01a63118787d0008648645ec486a2bc26a97feac8a3afd1021001030c0000000001419eb05372b1024000000982a0000f4271021007b17000010308c04"))));
+ verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ "01a63118787d0008648645ec486a2bc26a97feac8a3afd1021001030c0000000001419eb05372b1024000000982a0000f4271021007b17000010308c04"));
}
diff --git a/test/org/traccar/protocol/NavigilProtocolDecoderTest.java b/test/org/traccar/protocol/NavigilProtocolDecoderTest.java
index 3ad29e474..09883411e 100644
--- a/test/org/traccar/protocol/NavigilProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/NavigilProtocolDecoderTest.java
@@ -2,10 +2,9 @@ package org.traccar.protocol;
import java.nio.ByteOrder;
import org.jboss.netty.buffer.ChannelBuffers;
-import static org.junit.Assert.assertNull;
import org.junit.Test;
+import org.traccar.ProtocolDecoderTest;
import org.traccar.helper.ChannelBufferTools;
-import static org.traccar.helper.DecoderVerifier.verify;
public class NavigilProtocolDecoderTest extends ProtocolDecoderTest {
@@ -14,11 +13,11 @@ public class NavigilProtocolDecoderTest extends ProtocolDecoderTest {
NavigilProtocolDecoder decoder = new NavigilProtocolDecoder(new NavigilProtocol());
- assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString(
- "01004300040020000000f60203080200e7cd0f510c0000003b00000000000000"))));
+ verifyNothing(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ "01004300040020000000f60203080200e7cd0f510c0000003b00000000000000"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString(
- "0100b3000f0024000000f4a803080200ca0c1151ef8885f0b82e6d130400c00403000000"))));
+ verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ "0100b3000f0024000000f4a803080200ca0c1151ef8885f0b82e6d130400c00403000000"));
}
diff --git a/test/org/traccar/protocol/NavisProtocolDecoderTest.java b/test/org/traccar/protocol/NavisProtocolDecoderTest.java
index 863deb3d9..c0d0357b0 100644
--- a/test/org/traccar/protocol/NavisProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/NavisProtocolDecoderTest.java
@@ -1,11 +1,11 @@
package org.traccar.protocol;
+import org.traccar.ProtocolDecoderTest;
import org.traccar.helper.ChannelBufferTools;
import java.nio.ByteOrder;
import org.jboss.netty.buffer.ChannelBuffers;
-import static org.traccar.helper.DecoderVerifier.verify;
-import static org.junit.Assert.assertNull;
+
import org.junit.Test;
public class NavisProtocolDecoderTest extends ProtocolDecoderTest {
@@ -15,14 +15,14 @@ public class NavisProtocolDecoderTest extends ProtocolDecoderTest {
NavisProtocolDecoder decoder = new NavisProtocolDecoder(new NavisProtocol());
- assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString(
- "404E5443010000007B000000130044342A3E533A383631373835303035323035303739"))));
+ verifyNothing(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ "404E5443010000007B000000130044342A3E533A383631373835303035323035303739"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString(
- "404E5443010000007B0000005A0050692A3E410125DB0E00000015110707110A0C0880630000AA39A2381600020000000000000000000C110708110A0CB389793F1AEF263F00000000120034F516440000000000000000000000FAFF000000FAFF000000FAFF80808080"))));
+ verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ "404E5443010000007B0000005A0050692A3E410125DB0E00000015110707110A0C0880630000AA39A2381600020000000000000000000C110708110A0CB389793F1AEF263F00000000120034F516440000000000000000000000FAFF000000FAFF000000FAFF80808080"));
- assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString(
- "404E5443010000007B000000130047372A3E533A383631373835303035313236303639"))));
+ verifyNothing(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ "404E5443010000007B000000130047372A3E533A383631373835303035313236303639"));
}
diff --git a/test/org/traccar/protocol/NoranProtocolDecoderTest.java b/test/org/traccar/protocol/NoranProtocolDecoderTest.java
index a320e4c49..b3e454f6a 100644
--- a/test/org/traccar/protocol/NoranProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/NoranProtocolDecoderTest.java
@@ -2,10 +2,9 @@ package org.traccar.protocol;
import java.nio.ByteOrder;
import org.jboss.netty.buffer.ChannelBuffers;
-import static org.junit.Assert.assertNull;
import org.junit.Test;
+import org.traccar.ProtocolDecoderTest;
import org.traccar.helper.ChannelBufferTools;
-import static org.traccar.helper.DecoderVerifier.verify;
public class NoranProtocolDecoderTest extends ProtocolDecoderTest {
@@ -14,26 +13,26 @@ public class NoranProtocolDecoderTest extends ProtocolDecoderTest {
NoranProtocolDecoder decoder = new NoranProtocolDecoder(new NoranProtocol());
- //verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString(
- // "28003200c38000d900fcc97a416b1a7a42b43eef3d4e523039473034383737000000000092fcda4a"))));
+ //verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ // "28003200c38000d900fcc97a416b1a7a42b43eef3d4e523039473034383737000000000092fcda4a"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString(
- "3400080001090000000000001D43A29BE842E62520424E523039423036363932000031322D30332D30352031313A34373A343300"))));
+ verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ "3400080001090000000000001D43A29BE842E62520424E523039423036363932000031322D30332D30352031313A34373A343300"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString(
- "34000800010c000000000080a3438e20944149bd07c24e523039423139323832000031352d30342d32362030383a34333a353300"))));
+ verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ "34000800010c000000000080a3438e20944149bd07c24e523039423139323832000031352d30342d32362030383a34333a353300"));
- assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString(
- "0f0000004e52303946303431353500"))));
+ verifyNothing(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ "0f0000004e52303946303431353500"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString(
- "22000800010c008a007e9daa42317bdd41a7f3e2384e523039463034313535000000"))));
+ verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ "22000800010c008a007e9daa42317bdd41a7f3e2384e523039463034313535000000"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString(
- "34000800010c0000000000001c4291251143388d17c24e523039423131303930000031342d31322d32352030303a33333a303700"))));
+ verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ "34000800010c0000000000001c4291251143388d17c24e523039423131303930000031342d31322d32352030303a33333a303700"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString(
- "34000800010c00000000000000006520944141bd07c24e523039423139323832000031352d30342d32352030303a30333a323200"))));
+ verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ "34000800010c00000000000000006520944141bd07c24e523039423139323832000031352d30342d32352030303a30333a323200"));
}
diff --git a/test/org/traccar/protocol/OrionProtocolDecoderTest.java b/test/org/traccar/protocol/OrionProtocolDecoderTest.java
index 2a8d24199..fd0c74746 100644
--- a/test/org/traccar/protocol/OrionProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/OrionProtocolDecoderTest.java
@@ -3,8 +3,8 @@ package org.traccar.protocol;
import java.nio.ByteOrder;
import org.jboss.netty.buffer.ChannelBuffers;
import org.junit.Test;
+import org.traccar.ProtocolDecoderTest;
import org.traccar.helper.ChannelBufferTools;
-import static org.traccar.helper.DecoderVerifier.verify;
public class OrionProtocolDecoderTest extends ProtocolDecoderTest {
@@ -13,20 +13,20 @@ public class OrionProtocolDecoderTest extends ProtocolDecoderTest {
OrionProtocolDecoder decoder = new OrionProtocolDecoder(new OrionProtocol());
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString(
- "5057000137bf6236235a0331b5c6e402a3b5ecff5102980003000e0c1d172936080e0c1d172936b03b01000882050000008e080000000000008c0300940500000084030085030003067600900113150000000000000000000000000000000000000004a4c8"))));
+ verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ "5057000137bf6236235a0331b5c6e402a3b5ecff5102980003000e0c1d172936080e0c1d172936b03b01000882050000008e080000000000008c0300940500000084030085030003067600900113150000000000000000000000000000000000000004a4c8"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString(
- "5057004107367C242B440901ADE97D0163143B07B003000000000D041917382D000B0101000511000000000682050000008E080000000000008C0300840300850300090A0000000048010000008AFC"))));
+ verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ "5057004107367C242B440901ADE97D0163143B07B003000000000D041917382D000B0101000511000000000682050000008E080000000000008C0300840300850300090A0000000048010000008AFC"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString(
- "5057004107367C242C440901ADE97D0163143B07B003000000000D041917382D000B0101000513000000000682050000008E080000000000008C0300840300850300090A000000003BFEFFFF01FAE5"))));
+ verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ "5057004107367C242C440901ADE97D0163143B07B003000000000D041917382D000B0101000513000000000682050000008E080000000000008C0300840300850300090A000000003BFEFFFF01FAE5"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString(
- "5057004107367C242D440901ADE97D0163143B07B003000000000D041917382D000B0101000514000000000682050000008E080000000000008C0300840300850300090A00000000FDFDFFFF023721"))));
+ verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ "5057004107367C242D440901ADE97D0163143B07B003000000000D041917382D000B0101000514000000000682050000008E080000000000008C0300840300850300090A00000000FDFDFFFF023721"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString(
- "505700412ac86236354009114d20e402210f1f00d204000000000e06110d3414000b0101001228000000000682050000008e080000000000008c030084030085030003067b006801000930"))));
+ verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ "505700412ac86236354009114d20e402210f1f00d204000000000e06110d3414000b0101001228000000000682050000008e080000000000008c030084030085030003067b006801000930"));
}
diff --git a/test/org/traccar/protocol/OsmAndProtocolDecoderTest.java b/test/org/traccar/protocol/OsmAndProtocolDecoderTest.java
index 27fca29e7..5c9d9079a 100644
--- a/test/org/traccar/protocol/OsmAndProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/OsmAndProtocolDecoderTest.java
@@ -1,10 +1,7 @@
package org.traccar.protocol;
-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 org.junit.Test;
-import static org.traccar.helper.DecoderVerifier.verify;
+import org.traccar.ProtocolDecoderTest;
public class OsmAndProtocolDecoderTest extends ProtocolDecoderTest {
@@ -13,23 +10,23 @@ public class OsmAndProtocolDecoderTest extends ProtocolDecoderTest {
OsmAndProtocolDecoder decoder = new OsmAndProtocolDecoder(new OsmAndProtocol());
- verify(decoder.decode(null, null, new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET,
- "/?id=902064&lat=42.06288&lon=-88.23412&timestamp=1442068686579&hdop=6.0&altitude=224.0&speed=0.0")));
+ verifyPosition(decoder, request(
+ "/?id=902064&lat=42.06288&lon=-88.23412&timestamp=1442068686579&hdop=6.0&altitude=224.0&speed=0.0"));
- verify(decoder.decode(null, null, new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET,
- "/?lat=49.60688&lon=6.15788&timestamp=2014-06-04+09%3A10%3A11&altitude=384.7&speed=0.0&id=353861053849681")));
+ verifyPosition(decoder, request(
+ "/?lat=49.60688&lon=6.15788&timestamp=2014-06-04+09%3A10%3A11&altitude=384.7&speed=0.0&id=353861053849681"));
- verify(decoder.decode(null, null, new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET,
- "/?id=123456&timestamp=1377177267&lat=60.0&lon=30.0&speed=0.0&bearing=0.0&altitude=0&hdop=0.0")));
+ verifyPosition(decoder, request(
+ "/?id=123456&timestamp=1377177267&lat=60.0&lon=30.0&speed=0.0&bearing=0.0&altitude=0&hdop=0.0"));
- verify(decoder.decode(null, null, new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET,
- "/?id=123456&timestamp=1377177267&lat=60.0&lon=30.0")));
+ verifyPosition(decoder, request(
+ "/?id=123456&timestamp=1377177267&lat=60.0&lon=30.0"));
- 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")));
-
- verify(decoder.decode(null, null, new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET,
- "/?id=861001000719969&lat=41.666667&lon=-0.883333&altitude=350.059479&speed=0.000000&batt=87")));
+ verifyPosition(decoder, request(
+ "/?lat=60.0&lon=30.0&speed=0.0&heading=0.0&vacc=0&hacc=0&altitude=0&deviceid=123456"));
+
+ verifyPosition(decoder, request(
+ "/?id=861001000719969&lat=41.666667&lon=-0.883333&altitude=350.059479&speed=0.000000&batt=87"));
}
diff --git a/test/org/traccar/protocol/PiligrimProtocolDecoderTest.java b/test/org/traccar/protocol/PiligrimProtocolDecoderTest.java
index eef6cc65e..bd5c2460f 100644
--- a/test/org/traccar/protocol/PiligrimProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/PiligrimProtocolDecoderTest.java
@@ -1,14 +1,9 @@
package org.traccar.protocol;
-import org.jboss.netty.buffer.ChannelBuffers;
-import org.jboss.netty.handler.codec.http.DefaultHttpRequest;
import org.jboss.netty.handler.codec.http.HttpMethod;
-import org.jboss.netty.handler.codec.http.HttpRequest;
-import org.jboss.netty.handler.codec.http.HttpVersion;
-import static org.traccar.helper.DecoderVerifier.verify;
import org.junit.Test;
-import org.traccar.helper.ChannelBufferTools;
+import org.traccar.ProtocolDecoderTest;
public class PiligrimProtocolDecoderTest extends ProtocolDecoderTest {
@@ -17,10 +12,9 @@ public class PiligrimProtocolDecoderTest extends ProtocolDecoderTest {
PiligrimProtocolDecoder decoder = new PiligrimProtocolDecoder(new PiligrimProtocol());
- HttpRequest msg1 = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.POST, "/bingps?imei=868204005544720&csq=18&vout=00&vin=4050&dataid=00000000");
- msg1.setContent(ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "fff2200d4110061a32354f3422310062000a0005173b0000a101000300005e00fff2200d4110100932354f2b22310042000b000e173b00009f01000700006000")));
- verify(decoder.decode(null, null, msg1));
+ verifyPositions(decoder, request(HttpMethod.POST,
+ "/bingps?imei=868204005544720&csq=18&vout=00&vin=4050&dataid=00000000",
+ binary("fff2200d4110061a32354f3422310062000a0005173b0000a101000300005e00fff2200d4110100932354f2b22310042000b000e173b00009f01000700006000")));
}
diff --git a/test/org/traccar/protocol/ProgressProtocolDecoderTest.java b/test/org/traccar/protocol/ProgressProtocolDecoderTest.java
index 70e9acae4..26c54b974 100644
--- a/test/org/traccar/protocol/ProgressProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/ProgressProtocolDecoderTest.java
@@ -2,11 +2,11 @@ package org.traccar.protocol;
import org.jboss.netty.buffer.ChannelBuffers;
import org.junit.Test;
+import org.traccar.ProtocolDecoderTest;
import org.traccar.helper.ChannelBufferTools;
import java.nio.ByteOrder;
-import static org.junit.Assert.assertNull;
public class ProgressProtocolDecoderTest extends ProtocolDecoderTest {
@@ -15,14 +15,14 @@ public class ProgressProtocolDecoderTest extends ProtocolDecoderTest {
ProgressProtocolDecoder decoder = new ProgressProtocolDecoder(new ProgressProtocol());
- assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString(
- "020037000100000003003131310f003335343836383035313339303036320f00323530303136333832383531353535010000000100000000000000e6bb97b6"))));
+ verifyNothing(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ "020037000100000003003131310f003335343836383035313339303036320f00323530303136333832383531353535010000000100000000000000e6bb97b6"));
- /*verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString(
- "0a009f00700d000076b1345580feaf2720b7e71a0301000000327f39031f15d2b900ffffffffffffffff00ac2600000900040000000000000000000000000000e52a6810c20000000000001c49010000000000000000000000000d00000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000019000500eefff1ff0000000000000000000000000000000016151c91"))));
+ /*verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ "0a009f00700d000076b1345580feaf2720b7e71a0301000000327f39031f15d2b900ffffffffffffffff00ac2600000900040000000000000000000000000000e52a6810c20000000000001c49010000000000000000000000000d00000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000019000500eefff1ff0000000000000000000000000000000016151c91"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString(
- "0a009f00720d00008ab1345580feaf2720b7e71a0301000000327f39031f15d2b900ffffffffffffffff00ac2600000800050000000000000000000000000000e12a6810c10000000000001c49010000000000000000000000000d00000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000019000500eefff1ff00000000000000000000000000000000052a49f2"))));*/
+ verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ "0a009f00720d00008ab1345580feaf2720b7e71a0301000000327f39031f15d2b900ffffffffffffffff00ac2600000800050000000000000000000000000000e12a6810c10000000000001c49010000000000000000000000000d00000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000019000500eefff1ff00000000000000000000000000000000052a49f2"));*/
}
diff --git a/test/org/traccar/protocol/ProtocolDecoderTest.java b/test/org/traccar/protocol/ProtocolDecoderTest.java
deleted file mode 100644
index 1b73220d1..000000000
--- a/test/org/traccar/protocol/ProtocolDecoderTest.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package org.traccar.protocol;
-
-import org.traccar.Context;
-import org.traccar.helper.TestIdentityManager;
-
-public class ProtocolDecoderTest {
-
- static {
- try {
- Context.init(new TestIdentityManager());
- } catch(Exception error) {
- }
- }
-
-}
diff --git a/test/org/traccar/protocol/Pt3000ProtocolDecoderTest.java b/test/org/traccar/protocol/Pt3000ProtocolDecoderTest.java
index a5c85a51b..cadc76928 100644
--- a/test/org/traccar/protocol/Pt3000ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/Pt3000ProtocolDecoderTest.java
@@ -1,7 +1,7 @@
package org.traccar.protocol;
-import static org.traccar.helper.DecoderVerifier.verify;
import org.junit.Test;
+import org.traccar.ProtocolDecoderTest;
public class Pt3000ProtocolDecoderTest extends ProtocolDecoderTest {
@@ -10,10 +10,10 @@ public class Pt3000ProtocolDecoderTest extends ProtocolDecoderTest {
Pt3000ProtocolDecoder decoder = new Pt3000ProtocolDecoder(new Pt3000Protocol());
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"%356939010012099,$GPRMC,124945.752,A,4436.6245,N,01054.4634,E,0.11,358.52,060408,,,A,+393334347445,N028d"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"%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 06740a271..b09082b2e 100644
--- a/test/org/traccar/protocol/Pt502ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/Pt502ProtocolDecoderTest.java
@@ -1,7 +1,7 @@
package org.traccar.protocol;
import org.junit.Test;
-import static org.traccar.helper.DecoderVerifier.verify;
+import org.traccar.ProtocolDecoderTest;
public class Pt502ProtocolDecoderTest extends ProtocolDecoderTest {
@@ -10,34 +10,34 @@ public class Pt502ProtocolDecoderTest extends ProtocolDecoderTest {
Pt502ProtocolDecoder decoder = new Pt502ProtocolDecoder(new Pt502Protocol());
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"$POS,216769295715,163237.000,A,3258.1738,S,02755.4350,E,0.00,215.88,100915,,,A/0000,0//232300//5b3/"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"$POS,11023456,033731.000,A,0335.2617,N,09841.1587,E,0.00,88.12,210615,,,A/0000,0/1f8/388900//f33//"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"$POS,6094,205523.000,A,1013.6223,N,06728.4248,W,0.0,99.3,011112,,,A/00000,00000/0/23895000//"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"$POS,6120,233326.000,V,0935.1201,N,06914.6933,W,0.00,,151112,,,A/00000,00000/0/0/"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"$POS,6002,233257.000,A,0931.0430,N,06912.8707,W,0.05,146.98,141112,,,A/00010,00000/0/5360872"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"$POS,6095,233344.000,V,0933.0451,N,06912.3360,W,,,151112,,,N/00000,00000/0/1677600/"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"$PHO0,6091,233606.000,A,0902.9855,N,06944.3654,W,0.0,43.8,141112,,,A/00010,00000/0/224000//"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"$POS,353451000164,082405.000,A,1254.8501,N,10051.6752,E,0.00,237.99,160513,,,A/0000,0/0/55000//a71/"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"$POS,012896008586486,154215.000,A,0118.0143,S,03646.9144,E,0.00,83.29,180714,,,A/0000,0/0/29200//644/"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"$POS,1151000,205326.000,A,0901.3037,N,07928.2751,W,48.79,30.55,170814,,,A/00010,10000/0,0,0,0/15986500//fb8/"));
}
diff --git a/test/org/traccar/protocol/RitiProtocolDecoderTest.java b/test/org/traccar/protocol/RitiProtocolDecoderTest.java
index 1afbbea70..a6b9c159a 100644
--- a/test/org/traccar/protocol/RitiProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/RitiProtocolDecoderTest.java
@@ -3,8 +3,8 @@ package org.traccar.protocol;
import java.nio.ByteOrder;
import org.jboss.netty.buffer.ChannelBuffers;
import org.junit.Test;
+import org.traccar.ProtocolDecoderTest;
import org.traccar.helper.ChannelBufferTools;
-import static org.traccar.helper.DecoderVerifier.verify;
public class RitiProtocolDecoderTest extends ProtocolDecoderTest {
@@ -13,11 +13,11 @@ public class RitiProtocolDecoderTest extends ProtocolDecoderTest {
RitiProtocolDecoder decoder = new RitiProtocolDecoder(new RitiProtocol());
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString(
- "3b28a2a2056315316d4000008100000000000000005f710000244750524d432c3138303535332e3030302c412c353532342e383437312c4e2c30313133342e313837382c452c302e30302c2c3032313231332c2c2c412a37340d0a00000000000000000000000000000000040404"))));
+ verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ "3b28a2a2056315316d4000008100000000000000005f710000244750524d432c3138303535332e3030302c412c353532342e383437312c4e2c30313133342e313837382c452c302e30302c2c3032313231332c2c2c412a37340d0a00000000000000000000000000000000040404"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString(
- "3b2864a3056300006d40000003000000000000000000000000244750524d432c3231313734332e3030302c412c313335372e333637352c4e2c31303033362e363939322c452c302e30302c2c3031303931342c2c2c412a37380d0a00000000000000000000000000000000040404"))));
+ verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ "3b2864a3056300006d40000003000000000000000000000000244750524d432c3231313734332e3030302c412c313335372e333637352c4e2c31303033362e363939322c452c302e30302c2c3031303931342c2c2c412a37380d0a00000000000000000000000000000000040404"));
}
diff --git a/test/org/traccar/protocol/RuptelaProtocolDecoderTest.java b/test/org/traccar/protocol/RuptelaProtocolDecoderTest.java
index 1a9153ec2..89e71a938 100644
--- a/test/org/traccar/protocol/RuptelaProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/RuptelaProtocolDecoderTest.java
@@ -2,8 +2,8 @@ package org.traccar.protocol;
import org.jboss.netty.buffer.ChannelBuffers;
import org.junit.Test;
+import org.traccar.ProtocolDecoderTest;
import org.traccar.helper.ChannelBufferTools;
-import static org.traccar.helper.DecoderVerifier.verify;
public class RuptelaProtocolDecoderTest extends ProtocolDecoderTest {
@@ -12,20 +12,20 @@ public class RuptelaProtocolDecoderTest extends ProtocolDecoderTest {
RuptelaProtocolDecoder decoder = new RuptelaProtocolDecoder(new RuptelaProtocol());
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "0050000310f5615f419c0100015613d8ed0000fff5b37a035af37801e700000900000d07071b0c020003001c01202cad000500064302a81d33e61e100116317cd3ffff174ad60241000077fa960000f232003c2e"))));
+ verifyPositions(decoder, binary(
+ "0050000310f5615f419c0100015613d8ed0000fff5b37a035af37801e700000900000d07071b0c020003001c01202cad000500064302a81d33e61e100116317cd3ffff174ad60241000077fa960000f232003c2e"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "00560003116e7438a7a50100015565cbb9000020fd21300f113f4600005f000600090d090805011b13cf00020003001c012029ad00041d31dd1e0ebd160000c50000047200000000d0000000004100016a2a960000a5a300c9ee"))));
+ verifyPositions(decoder, binary(
+ "00560003116e7438a7a50100015565cbb9000020fd21300f113f4600005f000600090d090805011b13cf00020003001c012029ad00041d31dd1e0ebd160000c50000047200000000d0000000004100016a2a960000a5a300c9ee"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "00a10003116e7438a7a5010002553dddbe000020fddaff0f12289b007200000600000c070805011b18cf00020003001c01201dad01041d32d81e0d7d160000c50000047200000000d000000000410000b1ae960000a5a300553dddd4000020fdd96f0f122bfe005c16f80700050b090805011b18cf00020003001c01201ead01041d338a1e0d8d160000c50000047200000000d000000000410000b1bd960000a5a3001681"))));
+ verifyPositions(decoder, binary(
+ "00a10003116e7438a7a5010002553dddbe000020fddaff0f12289b007200000600000c070805011b18cf00020003001c01201dad01041d32d81e0d7d160000c50000047200000000d000000000410000b1ae960000a5a300553dddd4000020fdd96f0f122bfe005c16f80700050b090805011b18cf00020003001c01201ead01041d338a1e0d8d160000c50000047200000000d000000000410000b1bd960000a5a3001681"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "007900000b1a2a5585c30100024e9c036900000f101733208ff45e07b31b570a001009090605011b1a020003001c01ad01021d338e16000002960000601a41014bc16d004e9c038400000f104fdf20900d20075103b00a001308090605011b1a020003001c01ad01021d33b116000002960000601a41014bc1ea0028f9"))));
+ verifyPositions(decoder, binary(
+ "007900000b1a2a5585c30100024e9c036900000f101733208ff45e07b31b570a001009090605011b1a020003001c01ad01021d338e16000002960000601a41014bc16d004e9c038400000f104fdf20900d20075103b00a001308090605011b1a020003001c01ad01021d33b116000002960000601a41014bc1ea0028f9"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "009200000c07a6bacd4701000552db5cc20000187b8b251ace478e087c044c0a000009070000000052db5cfe0000187b8ab01ace47190879044c0900000b070000000052db5d3a0000187b8b251ace474b089d044c09000009070000000052db5d760000187b8b9a1ace475c08cd044c08000009070000000052db5db20000187b8b141ace46e708b3044c08000009070000000041cb"))));
+ verifyPositions(decoder, binary(
+ "009200000c07a6bacd4701000552db5cc20000187b8b251ace478e087c044c0a000009070000000052db5cfe0000187b8ab01ace47190879044c0900000b070000000052db5d3a0000187b8b251ace474b089d044c09000009070000000052db5d760000187b8b9a1ace475c08cd044c08000009070000000052db5db20000187b8b141ace46e708b3044c08000009070000000041cb"));
}
diff --git a/test/org/traccar/protocol/SanavProtocolDecoderTest.java b/test/org/traccar/protocol/SanavProtocolDecoderTest.java
index 0f881c82a..d7168ff2d 100644
--- a/test/org/traccar/protocol/SanavProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/SanavProtocolDecoderTest.java
@@ -1,7 +1,7 @@
package org.traccar.protocol;
-import static org.traccar.helper.DecoderVerifier.verify;
import org.junit.Test;
+import org.traccar.ProtocolDecoderTest;
public class SanavProtocolDecoderTest extends ProtocolDecoderTest {
@@ -10,22 +10,22 @@ public class SanavProtocolDecoderTest extends ProtocolDecoderTest {
SanavProtocolDecoder decoder = new SanavProtocolDecoder(new SanavProtocol());
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"imei=352024028982787&rmc=$GPRMC,103048.000,A,4735.0399,N,01905.2895,E,0.00,0.00,171013,,*05,AUTO-4095mv"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"imei:352024028980000rmc:$GPRMC,093604.354,A,4735.0862,N,01905.2146,E,0.00,0.00,171013,,*09,AUTO-4103mv"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"imei:352024027800000rmc:$GPRMC,000025.000,A,4735.0349,N,01905.2899,E,0.00,202.97,171013,,*03,3950mV,AUTO"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"imei:352024020976845rmc:$GPRMC,000201.000,A,4655.7043,N,01941.3796,E,0.54,159.14,171013,,,A*65,AUTO"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"imei=352024028982787&rmc=$GPRMC,103048.000,A,4735.0399,N,01905.2895,E,0.00,0.00,171013,,"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"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 e730358fe..9c7d79072 100644
--- a/test/org/traccar/protocol/SkypatrolProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/SkypatrolProtocolDecoderTest.java
@@ -1,8 +1,8 @@
package org.traccar.protocol;
import org.jboss.netty.buffer.ChannelBuffers;
-import static org.traccar.helper.DecoderVerifier.verify;
import org.junit.Test;
+import org.traccar.ProtocolDecoderTest;
import org.traccar.helper.ChannelBufferTools;
public class SkypatrolProtocolDecoderTest extends ProtocolDecoderTest {
@@ -12,18 +12,18 @@ public class SkypatrolProtocolDecoderTest extends ProtocolDecoderTest {
SkypatrolProtocolDecoder decoder = new SkypatrolProtocolDecoder(new SkypatrolProtocol());
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "0005021004FFFFFFFF0000000D313134373735383300CB000000000E11070C010184D032FB3841370000000016072B000017050032000000000000024E0C071116072C105900050000000000050000000000050000000003100260B7363B6306C11A00B73637F206BF19B73637F106B50EB73638B106BB0BB7363B6106B80AB73637F306B709000000000000000000C"))));
+ verifyPosition(decoder, binary(
+ "0005021004FFFFFFFF0000000D313134373735383300CB000000000E11070C010184D032FB3841370000000016072B000017050032000000000000024E0C071116072C105900050000000000050000000000050000000003100260B7363B6306C11A00B73637F206BF19B73637F106B50EB73638B106BB0BB7363B6106B80AB73637F306B709000000000000000000C"));
- //verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- // "000500030101383637383434303031373832333336420102000c0000fa07b5e101876c5b0e0a111606131c1b5e"))));
+ //verifyPosition(decoder, binary(
+ // "000500030101383637383434303031373832333336420102000c0000fa07b5e101876c5b0e0a111606131c1b5e"));
//Enfora TT8750
- //verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- // "000502000000f1143035303031393031d1df002f00000d0187120115e556ff762aa90000000000aae40005d2000ee1bc0e010a042530000000000000070004000002233c096c00ee2a00233c008500f022233c0b0500f21d233c000000fb23000000000000000000000000000000000000000000000000000000"))));
+ //verifyPosition(decoder, binary(
+ // "000502000000f1143035303031393031d1df002f00000d0187120115e556ff762aa90000000000aae40005d2000ee1bc0e010a042530000000000000070004000002233c096c00ee2a00233c008500f022233c0b0500f21d233c000000fb23000000000000000000000000000000000000000000000000000000"));
- //verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- // "00040200202020202020202020382020202020202030313137323230303131383531373820313220244750524d432c3232343833392e30302c412c303332382e3433383830362c4e2c30373633312e3630373731372c572c302e302c302e302c3139303731342c332e382c452c412a32420d0a00"))));
+ //verifyPosition(decoder, binary(
+ // "00040200202020202020202020382020202020202030313137323230303131383531373820313220244750524d432c3232343833392e30302c412c303332382e3433383830362c4e2c30373633312e3630373731372c572c302e302c302e302c3139303731342c332e382c452c412a32420d0a00"));
}
diff --git a/test/org/traccar/protocol/Stl060ProtocolDecoderTest.java b/test/org/traccar/protocol/Stl060ProtocolDecoderTest.java
index 75241c903..f167f983a 100644
--- a/test/org/traccar/protocol/Stl060ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/Stl060ProtocolDecoderTest.java
@@ -1,7 +1,7 @@
package org.traccar.protocol;
import org.junit.Test;
-import static org.traccar.helper.DecoderVerifier.verify;
+import org.traccar.ProtocolDecoderTest;
public class Stl060ProtocolDecoderTest extends ProtocolDecoderTest {
@@ -10,16 +10,16 @@ public class Stl060ProtocolDecoderTest extends ProtocolDecoderTest {
Stl060ProtocolDecoder decoder = new Stl060ProtocolDecoder(new Stl060Protocol());
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"$1,357804048043099,D001,AP29AW0963,23/02/14,14:06:54,17248488N,078342226E,0.08,193.12,1,1,1,1,1,A"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"$1,357804048043099,D001,AP29AW0963,12/05/14,07:39:57,1724.8564N,07834.2199E,0.00,302.84,1,1,1,1,1,A"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"$1,357804047969310,D001,AP29AW0963,01/01/13,13:24:47,1723.9582N,07834.0945E,00100,010,0,0,0,0,0,A,"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"$1,357804047969310,D001,AP29AW0963,01/01/13,13:24:47,1723.9582N,07834.0945E,00100,010,0,0,0,0,0,0008478660,1450,40,34,0,0,0,A"));
}
diff --git a/test/org/traccar/protocol/SuntechProtocolDecoderTest.java b/test/org/traccar/protocol/SuntechProtocolDecoderTest.java
index 980119c31..54cc77d6c 100644
--- a/test/org/traccar/protocol/SuntechProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/SuntechProtocolDecoderTest.java
@@ -1,8 +1,7 @@
package org.traccar.protocol;
-import static org.junit.Assert.assertNull;
import org.junit.Test;
-import static org.traccar.helper.DecoderVerifier.verify;
+import org.traccar.ProtocolDecoderTest;
public class SuntechProtocolDecoderTest extends ProtocolDecoderTest {
@@ -11,45 +10,45 @@ public class SuntechProtocolDecoderTest extends ProtocolDecoderTest {
SuntechProtocolDecoder decoder = new SuntechProtocolDecoder(new SuntechProtocol());
- assertNull(decoder.decode(null, null, "SA200ALV;317652"));
+ verifyNothing(decoder, text( "SA200ALV;317652"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"ST910;Alert;123456;410;20141018;18:30:12;+37.478774;+126.889690;000.000;000.00;0;4.0;1;6002"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"ST910;Alert;123456;410;20141018;18:30:12;+37.478774;+126.889690;000.000;000.00;0;4.0;1;6002;02;0;0310000100;450;01;-282;70;255;3;0"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"SA200STT;317652;042;20120718;15:37:12;16d41;-15.618755;-056.083241;000.024;000.00;8;1;41548;12.17;100000;2;1979"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"SA200STT;317652;042;20120721;19:04:30;16d41;-15.618743;-056.083221;000.001;000.00;12;1;41557;12.21;000000;1;3125"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"SA200STT;317652;042;20120722;00:24:23;4f310;-15.618767;-056.083214;000.011;000.00;11;1;41557;12.21;000000;1;3205"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"SA200STT;315198;042;20120808;20:37:34;3fac25;-15.618731;-056.083216;000.007;000.00;12;1;48;0.00;000000;1;0127"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"SA200STT;315198;042;20120809;13:43:34;4f310;-15.618709;-056.083223;000.025;000.00;8;1;49;12.10;100000;2;0231"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"SA200EMG;317652;042;20120718;15:35:41;16d41;-15.618740;-056.083252;000.034;000.00;8;1;41548;12.17;110000;1"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"SA200ALT;317652;042;20120829;14:25:58;16d41;-15.618770;-056.083242;000.029;000.00;0;0;2404240;0.00;000000;10"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"SA200STT;430070;133;20130615;22:22:32;151347;+02.860514;-060.653351;000.003;000.00;12;1;0;12.39;000000;1;0208"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"ST910;Location;344506;017;20130727;14:10:00;-25.398714;-049.296818;000.187;000.00;1;4.32;1;1;0001"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"ST300STT;205027329;03;374;20150108;17:54:42;177b38;-23.566052;-046.477588;000.000;000.00;0;0;0;12.11;000000;1;0312"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"ST910;Emergency;205283272;500;20150716;19:12:01;-23.659019;-046.695403;000.602;000.00;0;4.2;1;1;02;10820;2fdb090736;724;05;0;2311;255;0;100"));
}
diff --git a/test/org/traccar/protocol/T55ProtocolDecoderTest.java b/test/org/traccar/protocol/T55ProtocolDecoderTest.java
index 04c35aab7..ddabc8ee4 100644
--- a/test/org/traccar/protocol/T55ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/T55ProtocolDecoderTest.java
@@ -1,8 +1,7 @@
package org.traccar.protocol;
-import static org.junit.Assert.assertNull;
import org.junit.Test;
-import static org.traccar.helper.DecoderVerifier.verify;
+import org.traccar.ProtocolDecoderTest;
public class T55ProtocolDecoderTest extends ProtocolDecoderTest {
@@ -11,60 +10,60 @@ public class T55ProtocolDecoderTest extends ProtocolDecoderTest {
T55ProtocolDecoder decoder = new T55ProtocolDecoder(new T55Protocol());
- assertNull(decoder.decode(null, null, "$GPFID,ID123456ABC"));
+ verifyNothing(decoder, text( "$GPFID,ID123456ABC"));
- assertNull(decoder.decode(null, null, "$PGID,359853000144328*0F"));
+ verifyNothing(decoder, text( "$PGID,359853000144328*0F"));
- assertNull(decoder.decode(null, null, "$PCPTI,CradlePoint Test,184453,184453.0,6F*57"));
+ verifyNothing(decoder, text( "$PCPTI,CradlePoint Test,184453,184453.0,6F*57"));
- assertNull(decoder.decode(null, null, "IMEI 351467108700000"));
+ verifyNothing(decoder, text( "IMEI 351467108700000"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"$GPRMC,012006,A,4828.10,N,1353.52,E,0.00,0.00,180915,020.3,E*42"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"$GPRMC,094907.000,A,6000.5332,N,03020.5192,E,1.17,60.26,091111,,*33"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"$GPRMC,115528.000,A,6000.5432,N,03020.4948,E,,,091111,,*06"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"$GPRMC,064411.000,A,3717.240078,N,00603.046984,W,0.000,1,010313,,,A*6C"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"$GPGGA,000000.0,4337.200755,N,11611.955704,W,1,05,3.5,825.5,M,-11.0,M,,*6F"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"$GPGGA,000000,4807.038,N,01131.000,E,1,08,0.9,545.4,M,46.9,M,,*47"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"$GPRMA,V,0000.00,S,00000.00,E,,,00.0,000.,11.,E*7"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"$TRCCR,20140101001122.333,V,60.0,-100.0,1.1,2.2,3.3,4.4,*00"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"$TRCCR,20140111000000.000,A,60.000000,60.000000,0.00,0.00,0.00,50,*3a"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"$GPRMC,125735.000,A,6010.34349,N,02445.72838,E,1.0,101.7,050509,6.9,W,A*1F"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"$GPGGA,000000.000,6010.34349,N,02445.72838,E,1,05,1.7,0.9,M,35.1,M,,*59"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"123456789$GPGGA,000000.000,4610.1676,N,00606.4586,E,0,00,4.3,0.0,M,50.7,M,,0000*59"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"123456789$GPRMC,155708.252,V,4610.1676,N,00606.4586,E,000.0,000.0,060214,,,N*76"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"990000561287964,$GPRMC,213516.0,A,4337.216791,N,11611.995877,W,0.0,335.4,181214,,,A * 72"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"355096030432529$GPGGA,000000.00,3136.599,S,5213.981,W,1,7,2.13,250.00,M,-16.384,M,3550960304325290.0,1"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"355096030432529$GPGGA,000000.00,3136.628,S,5213.990,W,1,7,2.13,250.00,M,-16.384,M,0.0,1"));
}
diff --git a/test/org/traccar/protocol/TaipProtocolDecoderTest.java b/test/org/traccar/protocol/TaipProtocolDecoderTest.java
index 78ccd4c7f..d9f74f33d 100644
--- a/test/org/traccar/protocol/TaipProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/TaipProtocolDecoderTest.java
@@ -1,8 +1,7 @@
package org.traccar.protocol;
-import static org.junit.Assert.assertNotNull;
-import static org.traccar.helper.DecoderVerifier.verify;
import org.junit.Test;
+import org.traccar.ProtocolDecoderTest;
public class TaipProtocolDecoderTest extends ProtocolDecoderTest {
@@ -11,28 +10,28 @@ public class TaipProtocolDecoderTest extends ProtocolDecoderTest {
TaipProtocolDecoder decoder = new TaipProtocolDecoder(new TaipProtocol(), false);
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
">RGP230615010248-2682523-065236820000003007F4101;ID=0005;#0002;*2A<"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
">RGP190805211932-3457215-058493640000000FFBF0300;ID=8251;#2122;*54<"));
- assertNotNull(decoder.decode(null, null,
+ verifyPosition(decoder, text(
">RPV00000+3739438-1220384601512612;ID=1234;*7F"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"\r\n>REV691615354941+3570173+1397742703203212;ID=Test"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
">REV481599462982+2578391-0802945201228512;ID=Test"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
">REV131756153215+3359479-0075299001031332;VO=10568798;IO=310;SV=10;BL=4190;CV09=0;AD=0;AL=+47;ID=356612021059680"));
-
- assertNotNull(decoder.decode(null, null,
+
+ verifyPosition(decoder, text(
">RPV02138+4555512-0735478000000032;ID=1005;*76<"));
-
- assertNotNull(decoder.decode(null, null,
+
+ verifyPosition(decoder, text(
">RPV19105+4538405-0739518900000012;ID=9999;*7A<\r\n"));
}
diff --git a/test/org/traccar/protocol/TelikProtocolDecoderTest.java b/test/org/traccar/protocol/TelikProtocolDecoderTest.java
index c8c21c694..4344fe070 100644
--- a/test/org/traccar/protocol/TelikProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/TelikProtocolDecoderTest.java
@@ -1,8 +1,7 @@
package org.traccar.protocol;
-import static org.traccar.helper.DecoderVerifier.verify;
-import static org.junit.Assert.assertNull;
import org.junit.Test;
+import org.traccar.ProtocolDecoderTest;
public class TelikProtocolDecoderTest extends ProtocolDecoderTest {
@@ -11,10 +10,10 @@ public class TelikProtocolDecoderTest extends ProtocolDecoderTest {
TelikProtocolDecoder decoder = new TelikProtocolDecoder(new TelikProtocol());
- assertNull(decoder.decode(null, null,
+ verifyNothing(decoder, text(
"0026436729|232|01|003002030"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"182043672999,010100001301,0,270613041652,166653,475341,3,0,355,6,2,1,231,8112432,23201,01,00,217,0,0,0,0,7"));
}
diff --git a/test/org/traccar/protocol/TeltonikaProtocolDecoderTest.java b/test/org/traccar/protocol/TeltonikaProtocolDecoderTest.java
index 96efda58c..7e3f7cb35 100644
--- a/test/org/traccar/protocol/TeltonikaProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/TeltonikaProtocolDecoderTest.java
@@ -1,9 +1,9 @@
package org.traccar.protocol;
import org.jboss.netty.buffer.ChannelBuffers;
-import static org.traccar.helper.DecoderVerifier.verify;
-import static org.junit.Assert.assertNull;
+
import org.junit.Test;
+import org.traccar.ProtocolDecoderTest;
import org.traccar.helper.ChannelBufferTools;
public class TeltonikaProtocolDecoderTest extends ProtocolDecoderTest {
@@ -13,38 +13,38 @@ public class TeltonikaProtocolDecoderTest extends ProtocolDecoderTest {
TeltonikaProtocolDecoder decoder = new TeltonikaProtocolDecoder(new TeltonikaProtocol());
- assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "000F313233343536373839303132333435"))));
+ verifyNothing(decoder, binary(
+ "000F313233343536373839303132333435"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "000000000000003508010000014f8e016420002141bbaf0f4e96a7fffa0000120000000602010047030242669c92000002c7000000009100000000000100002df3"))));
+ verifyPositions(decoder, binary(
+ "000000000000003508010000014f8e016420002141bbaf0f4e96a7fffa0000120000000602010047030242669c92000002c7000000009100000000000100002df3"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "00000000000000A7080400000113fc208dff000f14f650209cca80006f00d60400040004030101150316030001460000015d0000000113fc17610b000f14ffe0209cc580006e00c00500010004030101150316010001460000015e0000000113fc284945000f150f00209cd200009501080400000004030101150016030001460000015d0000000113fc267c5b000f150a50209cccc0009300680400000004030101150016030001460000015b00040000"))));
+ verifyPositions(decoder, binary(
+ "00000000000000A7080400000113fc208dff000f14f650209cca80006f00d60400040004030101150316030001460000015d0000000113fc17610b000f14ffe0209cc580006e00c00500010004030101150316010001460000015e0000000113fc284945000f150f00209cd200009501080400000004030101150016030001460000015d0000000113fc267c5b000f150a50209cccc0009300680400000004030101150016030001460000015b00040000"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "000000000000014708060000013e5a60a4cb003fa7b780fc424518004200000a000000090501010200b300b400f000034268a746011818000001c700000000000000013e5dc8ba28003fa7c080fc4246040001000005000000090501010200b300b400f001034268b44600ef18000001c700000000000000013e5dc90455003fa7b640fc424388003a0000070000f0090501010200b300b400f000034268dc4600f718000001c70000001d000000013e5dc9d368003fa7b800fc4244300049000004000000090501010200b300b400f001034267de46010718000001c700000000000000013e5dca311d003fa7b680fc4243cc00420000070000f0090501010200b300b400f0000342685346010b18000001c700000000000000013e5dcfafe9003fa7b600fc4242f0003d000008000000090501010200b300b400f0000342685246011918000001c700000000000600000275"))));
+ verifyPositions(decoder, binary(
+ "000000000000014708060000013e5a60a4cb003fa7b780fc424518004200000a000000090501010200b300b400f000034268a746011818000001c700000000000000013e5dc8ba28003fa7c080fc4246040001000005000000090501010200b300b400f001034268b44600ef18000001c700000000000000013e5dc90455003fa7b640fc424388003a0000070000f0090501010200b300b400f000034268dc4600f718000001c70000001d000000013e5dc9d368003fa7b800fc4244300049000004000000090501010200b300b400f001034267de46010718000001c700000000000000013e5dca311d003fa7b680fc4243cc00420000070000f0090501010200b300b400f0000342685346010b18000001c700000000000000013e5dcfafe9003fa7b600fc4242f0003d000008000000090501010200b300b400f0000342685246011918000001c700000000000600000275"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "000000000000002c08010000013eff8d6f9800173295002111f400008100ae0b0000000401010003090016432980422f7200000100007a5d"))));
+ verifyPositions(decoder, binary(
+ "000000000000002c08010000013eff8d6f9800173295002111f400008100ae0b0000000401010003090016432980422f7200000100007a5d"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "00000000000000c7070441bf9db00fff425adbd741ca6e1e009e1205070001030b160000601a02015e02000314006615000a160067010500000ce441bf9d920fff425adbb141ca6fc900a2b218070001030b160000601a02015e02000314006615000a160067010500000cc641bf9d740fff425adbee41ca739200b6c91e070001030b1f0000601a02015f02000314006615000a160066010500000ca841bf9cfc0fff425adba041ca70c100b93813070001030b1f0000601a02015f02000314002315000a160025010500000c3004000000"))));
+ verifyPositions(decoder, binary(
+ "00000000000000c7070441bf9db00fff425adbd741ca6e1e009e1205070001030b160000601a02015e02000314006615000a160067010500000ce441bf9d920fff425adbb141ca6fc900a2b218070001030b160000601a02015e02000314006615000a160067010500000cc641bf9d740fff425adbee41ca739200b6c91e070001030b1f0000601a02015f02000314006615000a160066010500000ca841bf9cfc0fff425adba041ca70c100b93813070001030b1f0000601a02015f02000314002315000a160025010500000c3004000000"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "000000000000003107024c61410b013f4231c2c141d0beb9003d000005006483ff4c6140eb013f4231c2c141d0beb9003d000005006483ff02000041df"))));
+ verifyPositions(decoder, binary(
+ "000000000000003107024c61410b013f4231c2c141d0beb9003d000005006483ff4c6140eb013f4231c2c141d0beb9003d000005006483ff02000041df"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "000000000000002b080100000140d4e3ec6e000cc661d01674a5e0fffc00000900000004020100f0000242322318000000000100007a04"))));
+ verifyPositions(decoder, binary(
+ "000000000000002b080100000140d4e3ec6e000cc661d01674a5e0fffc00000900000004020100f0000242322318000000000100007a04"));
- assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "000000000000002d0c01060000002523464d323d3236323033323736313732313339362c32363230332c30372e30322e30350d0a0100009a2e"))));
+ verifyNothing(decoder, binary(
+ "000000000000002d0c01060000002523464d323d3236323033323736313732313339362c32363230332c30372e30322e30350d0a0100009a2e"));
- assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "000000000000000a0c0206000000020d0a0200006f4e"))));
+ verifyNothing(decoder, binary(
+ "000000000000000a0c0206000000020d0a0200006f4e"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "00000000000000a608010000013f14a1d1ce000f0eb790209a778000ab010c0500000000000000000100003390"))));
+ verifyPositions(decoder, binary(
+ "00000000000000a608010000013f14a1d1ce000f0eb790209a778000ab010c0500000000000000000100003390"));
}
diff --git a/test/org/traccar/protocol/Tk102ProtocolDecoderTest.java b/test/org/traccar/protocol/Tk102ProtocolDecoderTest.java
index d25b33439..fd8033902 100644
--- a/test/org/traccar/protocol/Tk102ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/Tk102ProtocolDecoderTest.java
@@ -1,8 +1,7 @@
package org.traccar.protocol;
-import static org.traccar.helper.DecoderVerifier.verify;
-import static org.junit.Assert.assertNull;
import org.junit.Test;
+import org.traccar.ProtocolDecoderTest;
public class Tk102ProtocolDecoderTest extends ProtocolDecoderTest {
@@ -11,30 +10,30 @@ public class Tk102ProtocolDecoderTest extends ProtocolDecoderTest {
Tk102ProtocolDecoder decoder = new Tk102ProtocolDecoder(new Tk102Protocol());
- assertNull(decoder.decode(null, null, ""));
+ verifyNothing(decoder, text( ""));
- assertNull(decoder.decode(null, null,
+ verifyNothing(decoder, text(
"[!0000000081r(353327023367238,TK102-W998_01_V1.1.001_130219,255,001,255,001,0,100,100,0,internet,0000,0000,0,0,255,0,4,1,11,00)"));
- assertNull(decoder.decode(null, null,
+ verifyNothing(decoder, text(
"[L0000001323N(GSM,0,0,07410001,20120101162600,404,010,9261,130,0,2353,130,35,9263,130,33,1)"));
- assertNull(decoder.decode(null, null,
+ verifyNothing(decoder, text(
"[%0000000082\u001d(100100000000000600-30-65535)"));
- assertNull(decoder.decode(null, null,
+ verifyNothing(decoder, text(
"[#0000000004\u0018(062100000000000600-0-0)"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"[=00000000836(ITV013939A4913.8317N02824.9241E000.90018031310010000)"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"[=00000000366(ITV012209A4913.8281N02824.9258E000.32018031310010000)"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"[;00000000106(ONE200834A5952.8114N01046.0832E003.93212071305010000)"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"[\u00930000000000F(ITV153047A1534.0805N03233.0888E000.00029041500000400&Wsz-wl001&B0000)]"));
}
diff --git a/test/org/traccar/protocol/Tk103ProtocolDecoderTest.java b/test/org/traccar/protocol/Tk103ProtocolDecoderTest.java
index 4d43166ee..43cc56fb9 100644
--- a/test/org/traccar/protocol/Tk103ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/Tk103ProtocolDecoderTest.java
@@ -1,8 +1,7 @@
package org.traccar.protocol;
-import static org.junit.Assert.assertNull;
import org.junit.Test;
-import static org.traccar.helper.DecoderVerifier.verify;
+import org.traccar.ProtocolDecoderTest;
public class Tk103ProtocolDecoderTest extends ProtocolDecoderTest {
@@ -11,85 +10,85 @@ public class Tk103ProtocolDecoderTest extends ProtocolDecoderTest {
Tk103ProtocolDecoder decoder = new Tk103ProtocolDecoder(new Tk103Protocol());
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"(088047365460BP05354188047365460150929A3258.1754S02755.4323E009.4193927301.9000000000L00000000)"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"(088048003342BP05354188048003342150917A1352.9801N10030.9050E000.0103115265.5600010000L000003F9)"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"(088048003342BR00150917A1352.9801N10030.9050E000.0103224000.0000010000L000003F9)"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"(088048003342BR00150807A1352.9871N10030.9084E000.0110718000.0001010000L00000000)"));
- assertNull(decoder.decode(null, null,
+ verifyNothing(decoder, text(
"(090411121854BP0000001234567890HSO"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"(01029131573BR00150428A3801.6382N02351.0159E000.0080729278.7800000000LEF9ECB9C)"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"(035988863964BP05000035988863964110524A4241.7977N02318.7561E000.0123536356.5100000000L000946BB"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"(013632782450BP05000013632782450120803V0000.0000N00000.0000E000.0174654000.0000000000L00000000"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"(013666666666BP05000013666666666110925A1234.5678N01234.5678W000.002033490.00000000000L000024DE"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"(013666666666BO012110925A1234.5678N01234.5678W000.0025948118.7200000000L000024DE"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"\n\n\n(088045133878BR00130228A5124.5526N00117.7152W000.0233614352.2200000000L01B0CF1C"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"(008600410203BP05000008600410203130721A4152.5790N01239.2770E000.0145238173.870100000AL0000000"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"(013012345678BR00130515A4843.9703N01907.6211E000.019232800000000000000L00009239"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"(012345678901BP05000012345678901130520A3439.9629S05826.3504W000.1175622323.8700000000L000450AC"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"(012345678901BR00130520A3439.9629S05826.3504W000.1175622323.8700000000L000450AC"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"(352606090042050,BP05,240414,V,0000.0000N,00000.0000E,000.0,193133,000.0"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"(352606090042050,BP05,240414,A,4527.3513N,00909.9758E,4.80,112825,155.49"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"(013632782450,BP05,101201,A,2234.0297N,11405.9101E,000.0,040137,178.48,00000000,L00000000"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"(864768010009188,BP05,271114,V,4012.19376N,00824.05638E,000.0,154436,000.0"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"(013632651491,BP05,040613,A,2234.0297N,11405.9101E,000.0,040137,178.48)"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"(013632651491,ZC07,040613,A,2234.0297N,11405.9101E,000.0,040137,178.48)"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"(013632651491,ZC11,040613,A,2234.0297N,11405.9101E,000.0,040137,178.48)"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"(013632651491,ZC12,040613,A,2234.0297N,11405.9101E,000.0,040137,178.48)"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"(013632651491,ZC13,040613,A,2234.0297N,11405.9101E,000.0,040137,178.48)"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"(013632651491,ZC17,040613,A,2234.0297N,11405.9101E,000.0,040137,178.48)"));
- assertNull(decoder.decode(null, null,
+ verifyNothing(decoder, text(
"(013632651491,ZC20,040613,040137,6,42,112,0)"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"(094050000111BP05000094050000111150808A3804.2418N04616.7468E000.0201447133.3501000011L0028019DT000)"));
}
diff --git a/test/org/traccar/protocol/Tlt2hProtocolDecoderTest.java b/test/org/traccar/protocol/Tlt2hProtocolDecoderTest.java
index 8de9f9ac8..b0f90a82d 100644
--- a/test/org/traccar/protocol/Tlt2hProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/Tlt2hProtocolDecoderTest.java
@@ -1,7 +1,7 @@
package org.traccar.protocol;
-import static org.traccar.helper.DecoderVerifier.verify;
import org.junit.Test;
+import org.traccar.ProtocolDecoderTest;
public class Tlt2hProtocolDecoderTest extends ProtocolDecoderTest {
@@ -10,31 +10,31 @@ public class Tlt2hProtocolDecoderTest extends ProtocolDecoderTest {
Tlt2hProtocolDecoder decoder = new Tlt2hProtocolDecoder(new Tlt2hProtocol());
- verify(decoder.decode(null, null,
- "#357671030946351#V500#0000#AUTO#1\r\n" +
+ verifyPositions(decoder, text(
+ "#357671030946351#V500#0000#AUTO#1\r\n",
"#$GPRMC,223835.000,A,0615.3545,S,10708.5779,E,14.62,97.41,070313,,,D*70\r\n"));
- verify(decoder.decode(null, null,
- "\r\n#357671030946351#V500#0000#AUTO#1\r\n" +
+ verifyPositions(decoder, text(
+ "\r\n#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"));
- verify(decoder.decode(null, null,
- "#357671030938911#V500#0000#AUTOSTOP#1\r\n" +
+ verifyPositions(decoder, text(
+ "#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"));
- 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" +
+ verifyPositions(decoder, text(
+ "#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"));
- 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" +
+ verifyPositions(decoder, text(
+ "#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"));
- verify(decoder.decode(null, null,
- "#357671031289215#V600#0000#AUTOLOW#1\r\n" +
+ verifyPositions(decoder, text(
+ "#357671031289215#V600#0000#AUTOLOW#1\r\n",
"#00735e1c$GPRMC,115647.000,A,5553.6524,N,02632.3128,E,0.00,0.0,130614,0.0,W,A*28"));
}
diff --git a/test/org/traccar/protocol/TopflytechProtocolDecoderTest.java b/test/org/traccar/protocol/TopflytechProtocolDecoderTest.java
index f1d44735f..8862befe4 100644
--- a/test/org/traccar/protocol/TopflytechProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/TopflytechProtocolDecoderTest.java
@@ -1,8 +1,7 @@
package org.traccar.protocol;
-import static org.traccar.helper.DecoderVerifier.verify;
-
import org.junit.Test;
+import org.traccar.ProtocolDecoderTest;
public class TopflytechProtocolDecoderTest extends ProtocolDecoderTest {
@@ -11,7 +10,7 @@ public class TopflytechProtocolDecoderTest extends ProtocolDecoderTest {
TopflytechProtocolDecoder decoder = new TopflytechProtocolDecoder(new TopflytechProtocol());
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"(880316890094910BP00XG00b600000000L00074b54S00000000R0C0F0014000100f0130531152205A0706.1395S11024.0965E000.0251.25"));
}
diff --git a/test/org/traccar/protocol/TotemProtocolDecoderTest.java b/test/org/traccar/protocol/TotemProtocolDecoderTest.java
index 28b08b055..11bf03c85 100644
--- a/test/org/traccar/protocol/TotemProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/TotemProtocolDecoderTest.java
@@ -1,8 +1,7 @@
package org.traccar.protocol;
-import static org.traccar.helper.DecoderVerifier.verify;
-import static org.junit.Assert.assertNull;
import org.junit.Test;
+import org.traccar.ProtocolDecoderTest;
public class TotemProtocolDecoderTest extends ProtocolDecoderTest {
@@ -14,64 +13,64 @@ public class TotemProtocolDecoderTest extends ProtocolDecoderTest {
// $$0128AA867521029231005|1880100015101802314842140000000000000000000000001AB48366093127600000.900000000806.1947N09818.4795E080355
// $$0108AA864244026063437|1A0000001401010101014111000027BA0E57003100000000.000000000000.0000N00000.0000E048156
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"$$BE863771024392112|AA$GPRMC,044704.000,A,1439.3334,N,12059.1417,E,0.00,0.00,200815,,,A*67|01.7|00.8|01.4|000000000000|20150820044704|14291265|00000000|4EECBF8B31|0000|0.0000|0002|00000|56E7"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"$$AE860990002922822|AA$GPRMC,051002.00,A,0439.26245,N,10108.94448,E,0.023,,140315,,,A*71|02.98|01.95|02.26|000000000000|20150314051003|13841157|105A3B1C|0000|0.0000|0005|5324"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"$$AE860990002922822|AA$GPRMC,051002.00,A,0439.26245,N,10108.94448,E,0.023,,140315,,,A*71|02.98|01.95|02.26|000000000000|20150314051003|13841157|105A3B1C|0000|0.0000|0005|5324\r"));
- assertNull(decoder.decode(null, null,
+ verifyNothing(decoder, text(
"$$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"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"$$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"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"$$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"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"$$8B862170017861566|AA180613080657|A|2237.1901|N|11402.1369|E|1.579|178|8.70|100000001000|13811|00000000|253162F5|00000000|0.0000|0014|2B16"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"$$72862170017856731|3913090911165280000370000000000000000019BD508A0400000003.400000093644.9817N01012.9944E00506F2E"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"$$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,
+ verifyNothing(decoder, text(
"$$AE359772033395899|AA000000000000000000000000000000000000000000000000000000000000|00.0|00.0|00.0|000000000000|20090215000153|13601435|00000000|00000000|0000|0.0000|0007|2DAA"));
- assertNull(decoder.decode(null, null,
+ verifyNothing(decoder, text(
"$$AE359772033395899|AA000000000000000000000000000000000000000000000000000000000000|00.0|00.0|00.0|00000000|20090215001204|14182037|00000000|0012D888|0000|0.0000|0016|5B51"));
- assertNull(decoder.decode(null, null,
+ verifyNothing(decoder, text(
"$$AE359772033395899|AA00000000000000000000000000000000000000000000000000000000000|00.0|00.0|00.0|00000000000|20090215001337|14182013|00000000|0012D888|0000|0.0000|0017|346E"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"$$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"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"$$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"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"$$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"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"$$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"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"$$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"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"$$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"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"$$B2356895037578518|AA$GPRMC,173829.000,A,3740.4107,N,02129.9815,E,0.00,,111113,,,A*7B|02.6|01.6|02.1|000000000000|20131111173829|14041251|00000000|002E0DD7|0000|0.0240|6010|8128"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"$$B2356895037578518|AA$GPRMC,203823.000,A,3740.3285,N,02129.9295,E,0.00,,111113,,,A*79|01.5|01.0|01.1|000000000000|20131111203823|14041251|00000000|002E0DD7|0000|0.0000|6371|3824"));
}
diff --git a/test/org/traccar/protocol/Tr20ProtocolDecoderTest.java b/test/org/traccar/protocol/Tr20ProtocolDecoderTest.java
index 2156e3385..2bf504176 100644
--- a/test/org/traccar/protocol/Tr20ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/Tr20ProtocolDecoderTest.java
@@ -1,8 +1,7 @@
package org.traccar.protocol;
-import static org.traccar.helper.DecoderVerifier.verify;
-import static org.junit.Assert.assertNull;
import org.junit.Test;
+import org.traccar.ProtocolDecoderTest;
public class Tr20ProtocolDecoderTest extends ProtocolDecoderTest {
@@ -11,9 +10,9 @@ public class Tr20ProtocolDecoderTest extends ProtocolDecoderTest {
Tr20ProtocolDecoder decoder = new Tr20ProtocolDecoder(new Tr20Protocol());
- assertNull(decoder.decode(null, null, "%%TRACKPRO01,1"));
+ verifyNothing(decoder, text( "%%TRACKPRO01,1"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"%%TR-10,A,050916070549,N2240.8887E11359.2994,0,000,NA,D3800000,150,CFG:resend|"));
}
diff --git a/test/org/traccar/protocol/Tr900ProtocolDecoderTest.java b/test/org/traccar/protocol/Tr900ProtocolDecoderTest.java
index 784d5b74e..627b2296f 100644
--- a/test/org/traccar/protocol/Tr900ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/Tr900ProtocolDecoderTest.java
@@ -1,7 +1,7 @@
package org.traccar.protocol;
import org.junit.Test;
-import static org.traccar.helper.DecoderVerifier.verify;
+import org.traccar.ProtocolDecoderTest;
public class Tr900ProtocolDecoderTest extends ProtocolDecoderTest {
@@ -10,13 +10,13 @@ public class Tr900ProtocolDecoderTest extends ProtocolDecoderTest {
Tr900ProtocolDecoder decoder = new Tr900ProtocolDecoder(new Tr900Protocol());
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
">00001001,4,1,150626,131252,W05830.2978,S3137.2783,,00,348,18,00,003-000,0,3,11111011*3b!"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
">12345678,1,1,070201,144111,W05829.2613,S3435.2313,,00,034,25,00,126-000,0,3,11111111*2d!"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
">00001001,4,1,150626,131252,W05830.2978,S3137.2783,,00,348,18,00,003-000,0,3,11111011*3b!\r\n"));
}
diff --git a/test/org/traccar/protocol/TrackboxProtocolDecoderTest.java b/test/org/traccar/protocol/TrackboxProtocolDecoderTest.java
index 4e6430ff2..08b17a130 100644
--- a/test/org/traccar/protocol/TrackboxProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/TrackboxProtocolDecoderTest.java
@@ -1,8 +1,7 @@
package org.traccar.protocol;
-import static org.traccar.helper.DecoderVerifier.verify;
-import static org.junit.Assert.assertNull;
import org.junit.Test;
+import org.traccar.ProtocolDecoderTest;
public class TrackboxProtocolDecoderTest extends ProtocolDecoderTest {
@@ -11,12 +10,12 @@ public class TrackboxProtocolDecoderTest extends ProtocolDecoderTest {
TrackboxProtocolDecoder decoder = new TrackboxProtocolDecoder(new TrackboxProtocol());
- assertNull(decoder.decode(null, null, "a=connect&v=11&i=111111111111111"));
+ verifyNothing(decoder, text( "a=connect&v=11&i=111111111111111"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"183457.999,5126.0247N,00002.8686E,5.2,70.4,3,57.63,32.11,17.32,150507,05"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"183558.999,5126.3979N,00003.0745E,5.2,70.4,3,57.63,32.11,17.32,150507,05"));
}
diff --git a/test/org/traccar/protocol/TramigoProtocolDecoderTest.java b/test/org/traccar/protocol/TramigoProtocolDecoderTest.java
index 9c8a4848c..35c3816a6 100644
--- a/test/org/traccar/protocol/TramigoProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/TramigoProtocolDecoderTest.java
@@ -3,8 +3,8 @@ package org.traccar.protocol;
import java.nio.ByteOrder;
import org.jboss.netty.buffer.ChannelBuffers;
import org.junit.Test;
+import org.traccar.ProtocolDecoderTest;
import org.traccar.helper.ChannelBufferTools;
-import static org.traccar.helper.DecoderVerifier.verify;
public class TramigoProtocolDecoderTest extends ProtocolDecoderTest {
@@ -13,16 +13,16 @@ public class TramigoProtocolDecoderTest extends ProtocolDecoderTest {
TramigoProtocolDecoder decoder = new TramigoProtocolDecoder(new TramigoProtocol());
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString(
- "80005408b000af000101b23903677f00c8436d3842616c697365204f6e653a20416c6c756d616765206d61726368652064e974656374e92c20676172e92c20302e3735206b6d20452064652045636f6c65204175746f726f757465206465204b696e73686173612c2056696c6c65206465204b696e73686173612c204b696e73686173612c2043442c202d342e33343130362c2031352e33343931352c2030313a3030204a616e2031202020454f46"))));
+ verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ "80005408b000af000101b23903677f00c8436d3842616c697365204f6e653a20416c6c756d616765206d61726368652064e974656374e92c20676172e92c20302e3735206b6d20452064652045636f6c65204175746f726f757465206465204b696e73686173612c2056696c6c65206465204b696e73686173612c204b696e73686173612c2043442c202d342e33343130362c2031352e33343931352c2030313a3030204a616e2031202020454f46"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString(
- "8000011bb0009e0001015b93032ef6f35994a9545472616d69676f3a204d6f76696e672c20302e3930206b6d205345206f66204372616e6562726f6f6b20466972652053746174696f6e2c2050656e726974682c205379646e65792c2041552c202d33332e37303732322c203135302e37313735392c2053452077697468207370656564203337206b6d2f682c2031393a3438204a616e20342020454f46"))));
+ verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ "8000011bb0009e0001015b93032ef6f35994a9545472616d69676f3a204d6f76696e672c20302e3930206b6d205345206f66204372616e6562726f6f6b20466972652053746174696f6e2c2050656e726974682c205379646e65792c2041552c202d33332e37303732322c203135302e37313735392c2053452077697468207370656564203337206b6d2f682c2031393a3438204a616e20342020454f46"));
// Tramigo: Parked, 0.12 km E of McDonald's H.V. dela Costa, Makati, 11:07 Mar 27
// Tramigo: Moving, 0.90 km SE of Cranebrook Fire Station, Penrith, Sydney, AU, -33.70722, 150.71759, SE with speed 37 km/h, 19:48 Jan 4 EOF
- //verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray(
+ //verifyPosition(decoder, text( ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray(
// new int[] {0x68,0x68,0x25,0x00,0x00,0x01,0x23,0x45,0x67,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}))));
}
diff --git a/test/org/traccar/protocol/TytanProtocolDecoderTest.java b/test/org/traccar/protocol/TytanProtocolDecoderTest.java
index 47c865d58..d291baa6e 100644
--- a/test/org/traccar/protocol/TytanProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/TytanProtocolDecoderTest.java
@@ -2,8 +2,8 @@ package org.traccar.protocol;
import org.jboss.netty.buffer.ChannelBuffers;
import org.junit.Test;
+import org.traccar.ProtocolDecoderTest;
import org.traccar.helper.ChannelBufferTools;
-import static org.traccar.helper.DecoderVerifier.verify;
public class TytanProtocolDecoderTest extends ProtocolDecoderTest {
@@ -12,17 +12,17 @@ public class TytanProtocolDecoderTest extends ProtocolDecoderTest {
TytanProtocolDecoder decoder = new TytanProtocolDecoder(new TytanProtocol());
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "B5005690000068494F561CEAE932325FD28D11A299000702000063045532030066013567018768014B6901286B0240396C04030785986D013E7F040000A7CE81040000A76C82027EAB83080FA01068FFFF0F3C880202583156"))));
+ verifyPositions(decoder, binary(
+ "B5005690000068494F561CEAE932325FD28D11A299000702000063045532030066013567018768014B6901286B0240396C04030785986D013E7F040000A7CE81040000A76C82027EAB83080FA01068FFFF0F3C880202583156"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "b50069a00000689d315604512b32378f1a8e9fe094005a04d7c84b41020300ab250402140c0702c0006501006601006b0280646c0402883db0315604525732378f1d8e9fdd94005a04d7c84b41020300ab250402140c0702c0006501006601006b0280646c0402883db08887"))));
+ verifyPositions(decoder, binary(
+ "b50069a00000689d315604512b32378f1a8e9fe094005a04d7c84b41020300ab250402140c0702c0006501006601006b0280646c0402883db0315604525732378f1d8e9fdd94005a04d7c84b41020300ab250402140c0702c0006501006601006b0280646c0402883db08887"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "b50028080000689d215602772f00378f1b8e9fdd98005a042efb3e4102030000000402140c070200000901"))));
+ verifyPositions(decoder, binary(
+ "b50028080000689d215602772f00378f1b8e9fdd98005a042efb3e4102030000000402140c070200000901"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "b500280a0000689d215602772f00378f1b8e9fdd98005a042efb3e4102030000000402140c07020000da20"))));
+ verifyPositions(decoder, binary(
+ "b500280a0000689d215602772f00378f1b8e9fdd98005a042efb3e4102030000000402140c07020000da20"));
}
diff --git a/test/org/traccar/protocol/TzoneProtocolDecoderTest.java b/test/org/traccar/protocol/TzoneProtocolDecoderTest.java
index 3b24b1d13..470e366cb 100644
--- a/test/org/traccar/protocol/TzoneProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/TzoneProtocolDecoderTest.java
@@ -3,10 +3,9 @@ package org.traccar.protocol;
import org.jboss.netty.buffer.ChannelBuffers;
import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
import org.junit.Test;
+import org.traccar.ProtocolDecoderTest;
import org.traccar.helper.ChannelBufferTools;
-import static org.traccar.helper.DecoderVerifier.verify;
public class TzoneProtocolDecoderTest extends ProtocolDecoderTest {
@@ -15,20 +14,20 @@ public class TzoneProtocolDecoderTest extends ProtocolDecoderTest {
TzoneProtocolDecoder decoder = new TzoneProtocolDecoder(new TzoneProtocol());
- assertNotNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "545a00582424010b021e000008637710239476270f080b0a3228001600000000000000000000000000000000000000000000000401a00822001088c00020183701a6053800000000800000000000000000000000000000000077c9860d0a"))));
+ verifyAttributes(decoder, binary(
+ "545a00582424010b021e000008637710239476270f080b0a3228001600000000000000000000000000000000000000000000000401a00822001088c00020183701a6053800000000800000000000000000000000000000000077c9860d0a"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "545A00912424010B021E000008661040203754350F061807083800160400CE5ADC041447620F0618070838000A0000060C7C0004253378370010AAC000000C37018504E500000000800000000000000000390B0A0014061113000000051200140610600014061220001000133800140610070010001473001000151100101500640010000920001000148400000000000000F2EF570D0A"))));
+ verifyPosition(decoder, binary(
+ "545A00912424010B021E000008661040203754350F061807083800160400CE5ADC041447620F0618070838000A0000060C7C0004253378370010AAC000000C37018504E500000000800000000000000000390B0A0014061113000000051200140610600014061220001000133800140610070010001473001000151100101500640010000920001000148400000000000000F2EF570D0A"));
- assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "545A009E2424010A0205000008637710225481290F010F081E33000000000010A0C000310E35000005840000000000000000000000000066140A00140612200010001511001406101000140612490014061308001015006400051400170014061012000000050200140612470000000504001406100700140612510014061260001015012000000005080014061252001406130900101501410000000506000853A40D0A"))));
+ verifyNothing(decoder, binary(
+ "545A009E2424010A0205000008637710225481290F010F081E33000000000010A0C000310E35000005840000000000000000000000000066140A00140612200010001511001406101000140612490014061308001015006400051400170014061012000000050200140612470000000504001406100700140612510014061260001015012000000005080014061252001406130900101501410000000506000853A40D0A"));
- assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "545A00992424010A0205000008637710225481290F010F082634000000000010A0C000311035000005870000000000000000000000000061130A000000050800101500640014061251001406130800051400170010150141001406101000140612200014061309000000050200140610070014061260001406124900140612470014061012001406125200100015110010150120000000050400183E8A0D0A"))));
+ verifyNothing(decoder, binary(
+ "545A00992424010A0205000008637710225481290F010F082634000000000010A0C000311035000005870000000000000000000000000061130A000000050800101500640014061251001406130800051400170010150141001406101000140612200014061309000000050200140610070014061260001406124900140612470014061012001406125200100015110010150120000000050400183E8A0D0A"));
- assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "545A00942424010A0205000008637710225481290F010F091C1F000000000010A1C000310F3500000586000000000000000000000000005C120A001406101000140612490014061012001406125200000005040000000502001015012000000005080010001511001406122000140612600014061247001406130900140610070010150141000514001700140612510010150064007A907C0D0A"))));
+ verifyNothing(decoder, binary(
+ "545A00942424010A0205000008637710225481290F010F091C1F000000000010A1C000310F3500000586000000000000000000000000005C120A001406101000140612490014061012001406125200000005040000000502001015012000000005080010001511001406122000140612600014061247001406130900140610070010150141000514001700140612510010150064007A907C0D0A"));
}
diff --git a/test/org/traccar/protocol/UlbotechProtocolDecoderTest.java b/test/org/traccar/protocol/UlbotechProtocolDecoderTest.java
index 38653a592..7e321fa8e 100644
--- a/test/org/traccar/protocol/UlbotechProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/UlbotechProtocolDecoderTest.java
@@ -1,10 +1,9 @@
package org.traccar.protocol;
import org.jboss.netty.buffer.ChannelBuffers;
-import static org.junit.Assert.assertNull;
import org.junit.Test;
+import org.traccar.ProtocolDecoderTest;
import org.traccar.helper.ChannelBufferTools;
-import static org.traccar.helper.DecoderVerifier.verify;
public class UlbotechProtocolDecoderTest extends ProtocolDecoderTest {
@@ -13,38 +12,38 @@ public class UlbotechProtocolDecoderTest extends ProtocolDecoderTest {
UlbotechProtocolDecoder decoder = new UlbotechProtocolDecoder(new UlbotechProtocol());
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "f8010103596580419465449da89d16010efe5580fe0923d82100140129005903040242000004040001a7f10506037818be220e070e31057b410c1324310d144131fa3208040020b1418297f8"))));
+ verifyPosition(decoder, binary(
+ "f8010103596580419465449da89d16010efe5580fe0923d82100140129005903040242000004040001a7f10506037818be220e070e31057b410c1324310d144131fa3208040020b1418297f8"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "f8010103596580419465449da8564e010efe55a1800923d04b0000000000710304000000000404000178d2050603571876220ec3caf8"))));
+ verifyPosition(decoder, binary(
+ "f8010103596580419465449da8564e010efe55a1800923d04b0000000000710304000000000404000178d2050603571876220ec3caf8"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "f8010103545500500179009ccb4b62010e00144db906310d3f0000000000cb0304000000000404000a8123050603211860221006080000000100000000ef97f8"))));
+ verifyPosition(decoder, binary(
+ "f8010103545500500179009ccb4b62010e00144db906310d3f0000000000cb0304000000000404000a8123050603211860221006080000000100000000ef97f8"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "F80101035785203457289495D60235010E016175A506C2C838000000000064"))));
+ verifyPosition(decoder, binary(
+ "F80101035785203457289495D60235010E016175A506C2C838000000000064"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "F8010108621060211481299C4247FA010E015EE1D606BDE797000301370081030402420000040400523CAF050603921743220706080000000000000000071131058E410C0E30310D48312F8E4131046A080402C8F2545445F8"))));
+ verifyPosition(decoder, binary(
+ "F8010108621060211481299C4247FA010E015EE1D606BDE797000301370081030402420000040400523CAF050603921743220706080000000000000000071131058E410C0E30310D48312F8E4131046A080402C8F2545445F8"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "F8010108621060211481299C4249FA010E015EE27506BDE80900020000008F030402420000040400523CAF05060392173F220706080000000000000000071131058E410C0E40310D48312F8E41310884080402CA60E43872F8"))));
+ verifyPosition(decoder, binary(
+ "F8010108621060211481299C4249FA010E015EE27506BDE80900020000008F030402420000040400523CAF05060392173F220706080000000000000000071131058E410C0E40310D48312F8E41310884080402CA60E43872F8"));
- assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "f8010108653280262660481cdacf830209ffffffffffffffff780304000300000404000000030506017418a021f99697f8"))));
+ verifyNothing(decoder, binary(
+ "f8010108653280262660481cdacf830209ffffffffffffffff780304000300000404000000030506017418a021f99697f8"));
- assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "f801010865328026266048fffeae800209ffffffffffffffff7803040200000004040000000005060375175421f3060800000000000000009c28f8"))));
+ verifyNothing(decoder, binary(
+ "f801010865328026266048fffeae800209ffffffffffffffff7803040200000004040000000005060375175421f3060800000000000000009c28f8"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "f8010108653280262660489ce260b4010e01e757bd022340d7002b010d01570304020200000404000000260506036a17d42200060800000000000000000a0101ab9ff8"))));
+ verifyPosition(decoder, binary(
+ "f8010108653280262660489ce260b4010e01e757bd022340d7002b010d01570304020200000404000000260506036a17d42200060800000000000000000a0101ab9ff8"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "f8010108653280262660489ce260df010e01e756f30223384a0003010a02a80304020200000404000001280506036217fe22010608000000000000000005aaf8"))));
+ verifyPosition(decoder, binary(
+ "f8010108653280262660489ce260df010e01e756f30223384a0003010a02a80304020200000404000001280506036217fe22010608000000000000000005aaf8"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "f8010108653280262660489ce26128010e01e769ac022336290014010300730304020200000404000003c905060371181c2201060800000000000000000a0140e471f8"))));
+ verifyPosition(decoder, binary(
+ "f8010108653280262660489ce26128010e01e769ac022336290014010300730304020200000404000003c905060371181c2201060800000000000000000a0140e471f8"));
}
diff --git a/test/org/traccar/protocol/V680ProtocolDecoderTest.java b/test/org/traccar/protocol/V680ProtocolDecoderTest.java
index 8180a700a..e3c0548ce 100644
--- a/test/org/traccar/protocol/V680ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/V680ProtocolDecoderTest.java
@@ -1,8 +1,7 @@
package org.traccar.protocol;
-import static org.traccar.helper.DecoderVerifier.verify;
-import static org.junit.Assert.assertNull;
import org.junit.Test;
+import org.traccar.ProtocolDecoderTest;
public class V680ProtocolDecoderTest extends ProtocolDecoderTest {
@@ -11,55 +10,55 @@ public class V680ProtocolDecoderTest extends ProtocolDecoderTest {
V680ProtocolDecoder decoder = new V680ProtocolDecoder(new V680Protocol());
- assertNull(decoder.decode(null, null,
+ verifyNothing(decoder, text(
"#353588102019155"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"#135790246811222#13486119277#1#0000#SOS#1#27bc10af#11407.4182,E,2232.7632,N,0.00,79.50#070709#134147.000##"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"#356823031193431##0#0000#SF#1#72403#V#04702.3025,W,2252.18380,S,008.18,0#090413#134938"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"#356823033219838#1000#0#1478#AUT#1#66830FFB#03855.6628,E,4716.6821,N,001.41,259#130812#143905"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"#353588102019155##1#0000#AUT#01#7240060be7873f#4849.079800,W,2614.458200,S,0.00,0.00#130413#182110.000"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"#353588302045917##1#0000#AUT#01#7243141c2b14c3#4738.442300,W,2334.874000,S,0.00,0.30#170413#004831.000"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"#352897045085282##0#0000#AUT#1#72400510730208,00d36307,10734fc4#4647.8922,W,2339.1956,S,2.60,63.74#200413#094310.000"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"#356823033537791##0#0000#AUT#1#V#03610.2179,E,5004.5796,N,000.01,349#180513#073758"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"#356823031236214##0#0000#AUT#1#V#01904.5491,E,6941.0085,N,000.09,248#170513#160140"));
- assertNull(decoder.decode(null, null,
+ verifyNothing(decoder, text(
"#353588550032869##1#0000#AUT#01#72400401cd01a5#00000.0000,E,0000.0000,N,0.00,#000000#000000.000"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"#352897045085282##0#0000#AUT#1#72400510730208,00d36307,10734fc4#4647.8922,W,2339.1956,S,2.60,63.74#200413#094310.000##"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"#352165050199210##13#0000#AUT#1#72400605471305,054712fd,054712ff#05144.0008,W,3005.5011,S,0.11,201.46#260713#172647.000##"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"#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##"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"#355488020132015##1#0000#AUT#01#510089246a34c0#10641.338800,E,619.427100,S,0.00,0.00#011113#161942.000##"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"#359094025419110#bigfriend#0#1234#AUTO#1##04632.8846,W,2327.2264,S,0.00,0.00#220913#234808##"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"#353588102031599##1#0000#AUT#01#41300304843fc1#7955.124400,E,642.095500,N,5.28,95.21#041213#074431.000##"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"1#0000#AUT#01#23403007fa650e#16.747700,W,5136.356500,N,0.00,0.00#040415#002051.000"));
}
diff --git a/test/org/traccar/protocol/VisiontekProtocolDecoderTest.java b/test/org/traccar/protocol/VisiontekProtocolDecoderTest.java
index 5d1879193..ad637256e 100644
--- a/test/org/traccar/protocol/VisiontekProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/VisiontekProtocolDecoderTest.java
@@ -1,8 +1,7 @@
package org.traccar.protocol;
-import static org.junit.Assert.assertNull;
import org.junit.Test;
-import static org.traccar.helper.DecoderVerifier.verify;
+import org.traccar.ProtocolDecoderTest;
public class VisiontekProtocolDecoderTest extends ProtocolDecoderTest {
@@ -11,19 +10,19 @@ public class VisiontekProtocolDecoderTest extends ProtocolDecoderTest {
VisiontekProtocolDecoder decoder = new VisiontekProtocolDecoder(new VisiontekProtocol());
- //verify(decoder.decode(null, null,
+ //verifyPosition(decoder, text(
// "$1,AP116,05,06,15,11,48,32,1725.0460N,07824.5289E,0617,07,0,030,2091,0,0,0,1,1,1,1,20,00.0000,00.3820,00.0000,VAJRA V1.00,A#"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"$1,AP09BU9397,861785006462448,20,06,14,15,03,28,17267339N,078279407E,060.0,073,0550,11,0,1,0,0,1,1,26,A,0000000000"));
- assertNull(decoder.decode(null, null,
+ verifyNothing(decoder, text(
"$1,AP09BU9397,861785006462448,20,06,14,15,03,28,000000000,0000000000,000.0,000,0000,00,0,1,0,0,1,1,24,V,0000000000"));
- assertNull(decoder.decode(null, null,
+ verifyNothing(decoder, text(
"$1,1234567890,02,06,11,17,07,45,00000000,000000000,00.0,0,0,V"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"$1,1234567890,02,06,11,17,07,45,17267690N,078279340E,060.0,113,0,A"));
}
diff --git a/test/org/traccar/protocol/WialonProtocolDecoderTest.java b/test/org/traccar/protocol/WialonProtocolDecoderTest.java
index dbf2c0eac..3541ceb8d 100644
--- a/test/org/traccar/protocol/WialonProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/WialonProtocolDecoderTest.java
@@ -1,8 +1,7 @@
package org.traccar.protocol;
-import static org.traccar.helper.DecoderVerifier.verify;
-import static org.junit.Assert.assertNull;
import org.junit.Test;
+import org.traccar.ProtocolDecoderTest;
public class WialonProtocolDecoderTest extends ProtocolDecoderTest {
@@ -11,40 +10,40 @@ public class WialonProtocolDecoderTest extends ProtocolDecoderTest {
WialonProtocolDecoder decoder = new WialonProtocolDecoder(new WialonProtocol());
- assertNull(decoder.decode(null, null, "#L#123456789012345;test"));
+ verifyNothing(decoder, text( "#L#123456789012345;test"));
- assertNull(decoder.decode(null, null, "#L#2002;NA"));
+ verifyNothing(decoder, text( "#L#2002;NA"));
- assertNull(decoder.decode(null, null, "#P#"));
+ verifyNothing(decoder, text( "#P#"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"#SD#270413;205601;5544.6025;N;03739.6834;E;1;2;3;4"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"#SD#021214;065947;2237.7552;N;11404.8851;E;0.000;;170.9;5"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"#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"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"#D#190114;051312;4459.6956;N;04105.9930;E;35;306;204.000000;12;NA;452986639;NA;106.000000;NA;sats_gps:1:9,sats_glonass:1:3,balance:2:12123.000000,stay_balance:1:0"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"#D#021214;065947;2237.7552;N;11404.8851;E;0.000;;170.9;5;1.74;NA;NA;NA;NA;NA"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"#D#021214;065947;2237.7552;N;11404.8851;E;0.000;;170.9;5;1.74;NA;NA;;NA;NA"));
- verify(decoder.decode(null, null,
+ verifyPositions(decoder, text(
"#B#080914;073235;5027.50625;N;03026.19321;E;0.700;0.000;NA;4;NA;NA;NA;;NA;Батарея:3:100 %|080914;073420;5027.50845;N;03026.18854;E;1.996;292.540;NA;4;NA;NA;NA;;NA;Батарея:3:100 %"));
- verify(decoder.decode(null, null,
+ verifyPositions(decoder, text(
"#B#110914;102132;5027.50728;N;03026.20369;E;1.979;288.170;NA;NA;NA;NA;NA;;NA;Батарея:3:100 %"));
- verify(decoder.decode(null, null,
+ verifyPositions(decoder, text(
"#B#110315;045857;5364.0167;N;06127.8262;E;0;155;965;7;2.40;4;0;;NA;Uacc:2:3.4,Iacc:2:0.000,Uext:2:13.2,Tcpu:2:14.4,Balance:2:167.65,GPS:3:Off"));
- verify(decoder.decode(null, null,
+ verifyPositions(decoder, text(
"#B#110315;045857;5364.0167;N;06127.8262;E;0;155;965;7;2.40;4;0;14.77,0.02,3.6;AB45DF01145;"));
}
diff --git a/test/org/traccar/protocol/WondexProtocolDecoderTest.java b/test/org/traccar/protocol/WondexProtocolDecoderTest.java
index 2aec5d450..5173734a8 100644
--- a/test/org/traccar/protocol/WondexProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/WondexProtocolDecoderTest.java
@@ -1,7 +1,7 @@
package org.traccar.protocol;
-import static org.traccar.helper.DecoderVerifier.verify;
import org.junit.Test;
+import org.traccar.ProtocolDecoderTest;
public class WondexProtocolDecoderTest extends ProtocolDecoderTest {
@@ -10,25 +10,25 @@ public class WondexProtocolDecoderTest extends ProtocolDecoderTest {
WondexProtocolDecoder decoder = new WondexProtocolDecoder(new WondexProtocol());
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"1044989601,20130323074605,0.000000,90.000000,0,000,0,0,2"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"123456789000001,20120101123200,130.000000,60.000000,0,000,0,0,0,0"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"210000001,20070313170040,121.123456,12.654321,0,233,0,9,2,0.0,0,0.00,0.00,0"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"1044989601,20130322172647,13.572583,52.401070,22,204,49,0,2"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"1044989601,20130322172647,13.572583,52.401070,22,204,-49,0,2"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"3997324533,20140326074908,28.797603,47.041635,0,48,0,6,2,3.90V,0"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"2000000001,20140529213210,-63.179111,9.781493,0,0,54.0,8,2,0.0,0,0.01,0.01,0,0,0,0"));
}
diff --git a/test/org/traccar/protocol/XexunProtocolDecoderTest.java b/test/org/traccar/protocol/XexunProtocolDecoderTest.java
index 85f7921fb..a228a1e2a 100644
--- a/test/org/traccar/protocol/XexunProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/XexunProtocolDecoderTest.java
@@ -1,8 +1,8 @@
package org.traccar.protocol;
-import static org.junit.Assert.assertNull;
-import static org.traccar.helper.DecoderVerifier.verify;
+
import org.junit.Test;
+import org.traccar.ProtocolDecoderTest;
public class XexunProtocolDecoderTest extends ProtocolDecoderTest {
@@ -11,81 +11,81 @@ public class XexunProtocolDecoderTest extends ProtocolDecoderTest {
XexunProtocolDecoder decoder = new XexunProtocolDecoder(new XexunProtocol(), false);
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"GPRMC,150120.000,A,3346.4463,S,15057.3083,E,0.0,117.4,010911,,,A*76,F,imei:351525010943661,"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"GPRMC,010203.000,A,0102.0003,N,00102.0003,E,1.02,1.02,010203,,,A*00,F,,imei:10000000000000,"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"GPRMC,233842.000,A,5001.3060,N,01429.3243,E,0.00,,210211,,,A*74,F,imei:354776030495631,"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"GPRMC,080303.000,A,5546.7313,N,03738.6005,E,0.56,160.13,100311,,,A*6A,L,imei:354778030461167,"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"GPRMC,220828.678,A,5206.1446,N,02038.2403,,0,0,160912,,,E*23,L,imei:358948012501019,"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"GNRMC,134418.000,A,5533.8973,N,03745.4398,E,0.00,308.85,160215,,,A*7A,F,, imei:864244028033115,"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"GPRMC,093341.000,A,1344.5716,N,10033.6648,E,0.00,0.00,240215,,,A*68,F,,imei:865328028306149,"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"GPRMC,103731.636,A,4545.5266,N,00448.8259,E,21.12,276.01,150615,,,A*57,L,, imei:013949002026675,"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"GPRMC,014623.000,A,4710.8260,N,1948.1220,E,0.11,105.40,111212,00,0000.0,A*49,F,,imei:357713002048962,"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"GPRMC,043435.000,A,811.299200,S,11339.9500,E,0.93,29.52,160313,00,0000.0,A*65,F,,imei:359585014597923,"));
decoder = new XexunProtocolDecoder(new XexunProtocol(), true);
- assertNull(decoder.decode(null, null,
+ verifyNothing(decoder, text(
",+48606717068,,L,, imei:012207005047292,,,F:4.28V,1,52,11565,247,01,000E,1FC5"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"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"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"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"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"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"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"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"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"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"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"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"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"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"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"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"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"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"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"140602152533,TESCO_INFO,GPRMC,152533.000,A,5145.4275,N,00000.3448,E,0.00,0.00,020614,,,A*66,F,, imei:013227002781643,06,35.1,F:4.15V,1,135,38950,234,10,10B4,5235"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"150216154418,5277,GNRMC,134418.000,A,5533.8973,N,03745.4398,E,0.00,308.85,160215,,,A*7A,F,, imei:864244028033115,10,169.8,F:4.28V,1,132,48269,250,99,6D0D,8572"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"150224173341,+66961544651,GPRMC,093341.000,A,1344.5716,N,10033.6648,E,0.00,0.00,240215,,,A*68,F,,imei:865328028306149,05,106.4,F:4.01V/ADC1=0.20V/ADC2=0.00V,0,159,955,520,01,5DE8,0399,6.21km"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"150316182840,07872167745,GPRMC,182840.000,A,5126.1310,N,00055.5573,W,0.00,0.00,160315,,,A*7C,F,,imei:865328023469306,06,54.3,F:4.10V/ADC1=0.76V/ADC2=0.00V,0,157,38486,234,10,34DC,48A6,3.70km"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"150615123731,+33647384611,GPRMC,103731.636,A,4545.5266,N,00448.8259,E,21.12,276.01,150615,,,A*57,L,, imei:013949002026675,04,3522.9,F:3.72V,0,142,21744,208,01,0702,9C8C"));
}
diff --git a/test/org/traccar/protocol/XirgoProtocolDecoderTest.java b/test/org/traccar/protocol/XirgoProtocolDecoderTest.java
index 775379c4e..b7b2ace73 100644
--- a/test/org/traccar/protocol/XirgoProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/XirgoProtocolDecoderTest.java
@@ -1,7 +1,7 @@
package org.traccar.protocol;
import org.junit.Test;
-import static org.traccar.helper.DecoderVerifier.verify;
+import org.traccar.ProtocolDecoderTest;
public class XirgoProtocolDecoderTest extends ProtocolDecoderTest {
@@ -10,16 +10,16 @@ public class XirgoProtocolDecoderTest extends ProtocolDecoderTest {
XirgoProtocolDecoder decoder = new XirgoProtocolDecoder(new XirgoProtocol());
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"$$354660046140722,6001,2013/01/22,15:36:18,25.80907,-80.32531,7.1,19,165.2,11,0.8,11.1,17,1,1,3.9,2##"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"$$357207059646786,4003,2015/05/19,15:54:56,-20.21422,-70.14927,37.5,1.8,0.0,11,0.8,12.9,31,297,1,0,0.0,0.0,0,1,1,1##"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"$$354898045650537,6031,2015/02/26,15:47:26,33.42552,-112.30308,287.8,0,0,0,0,0.0,7,1.2,2,0.0,12.2,22,1,0,82.3"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"$$357207059646786,4003,2015/05/19,15:55:27,-20.21421,-70.14920,33.6,0.4,0.0,11,0.8,12.9,31,297,1,0,0.0,0.0,0,1,1,1##"));
}
diff --git a/test/org/traccar/protocol/Xt013ProtocolDecoderTest.java b/test/org/traccar/protocol/Xt013ProtocolDecoderTest.java
index 2f0e95596..aafd597ac 100644
--- a/test/org/traccar/protocol/Xt013ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/Xt013ProtocolDecoderTest.java
@@ -1,8 +1,7 @@
package org.traccar.protocol;
import org.junit.Test;
-
-import static org.traccar.helper.DecoderVerifier.verify;
+import org.traccar.ProtocolDecoderTest;
public class Xt013ProtocolDecoderTest extends ProtocolDecoderTest {
@@ -11,13 +10,13 @@ public class Xt013ProtocolDecoderTest extends ProtocolDecoderTest {
Xt013ProtocolDecoder decoder = new Xt013ProtocolDecoder(new Xt013Protocol());
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"TK,862950021650364,150131090859,+53.267863,+5.767363,0,38,12,0,F,204,08,C94,336C,24,,4.09,1,,,,,,,,"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"TK,862950021650364,150118113832,+53.267722,+5.767143,0,86,12,0,F,204,08,C94,336C,22,,4.21,1,,,,,,,,"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"HI,862950021650364TK,862950021650364,150118113832,+53.267722,+5.767143,0,86,12,0,F,204,08,C94,336C,22,,4.21,1,,,,,,,,"));
}
diff --git a/test/org/traccar/protocol/YwtProtocolDecoderTest.java b/test/org/traccar/protocol/YwtProtocolDecoderTest.java
index 7743d90b4..6e7edde97 100644
--- a/test/org/traccar/protocol/YwtProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/YwtProtocolDecoderTest.java
@@ -1,8 +1,7 @@
package org.traccar.protocol;
-import static org.traccar.helper.DecoderVerifier.verify;
-import static org.junit.Assert.assertNull;
import org.junit.Test;
+import org.traccar.ProtocolDecoderTest;
public class YwtProtocolDecoderTest extends ProtocolDecoderTest {
@@ -11,16 +10,16 @@ public class YwtProtocolDecoderTest extends ProtocolDecoderTest {
YwtProtocolDecoder decoder = new YwtProtocolDecoder(new YwtProtocol());
- assertNull(decoder.decode(null, null,
+ verifyNothing(decoder, text(
"%SN,0417061042:0,0,140117041203,404"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"%GP,3000012345:0,090723182813,E114.602345,N22.069725,,30,160,4,0,00,,2794-10FF-46000,3>0-0"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"%RP,3000012345:0,090807182815,E114.602345,N22.069725,,30,160,4,0,00"));
- verify(decoder.decode(null, null,
+ verifyPosition(decoder, text(
"%KP,3000012345:0,090807183115,E114.602345,N22.069725,,30,160,5,0,00;"));
}