aboutsummaryrefslogtreecommitdiff
path: root/test/org
diff options
context:
space:
mode:
Diffstat (limited to 'test/org')
-rw-r--r--test/org/traccar/helper/DecoderVerifier.java25
-rw-r--r--test/org/traccar/protocol/Gt06ProtocolDecoderTest.java5
2 files changed, 25 insertions, 5 deletions
diff --git a/test/org/traccar/helper/DecoderVerifier.java b/test/org/traccar/helper/DecoderVerifier.java
index 17b4f9633..28220b711 100644
--- a/test/org/traccar/helper/DecoderVerifier.java
+++ b/test/org/traccar/helper/DecoderVerifier.java
@@ -2,7 +2,10 @@ package org.traccar.helper;
import java.util.Date;
import java.util.List;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import org.traccar.model.Data;
import org.traccar.model.Position;
public class DecoderVerifier {
@@ -40,6 +43,14 @@ public class DecoderVerifier {
assertNotNull(position.getAttributes());
}
+
+ private static void verifyData(Data data) {
+
+ assertNotNull(data.getDeviceId());
+
+ assertNotNull(data.getAttributes());
+
+ }
public static void verify(Object object) {
@@ -47,13 +58,19 @@ public class DecoderVerifier {
if (object instanceof Position) {
verifyPosition((Position) object);
+ } else if (object instanceof Data) {
+ verifyData((Data) object);
} else if (object instanceof List) {
- List<Position> positions = (List<Position>) object;
+ List positions = (List) object;
assertFalse(positions.isEmpty());
- for (Position position : positions) {
- verifyPosition(position);
+ for (Object item : positions) {
+ if (item instanceof Position) {
+ verifyPosition((Position) item);
+ } else if (item instanceof Data) {
+ verifyData((Data) item);
+ }
}
}
diff --git a/test/org/traccar/protocol/Gt06ProtocolDecoderTest.java b/test/org/traccar/protocol/Gt06ProtocolDecoderTest.java
index f8276b123..a72c709f2 100644
--- a/test/org/traccar/protocol/Gt06ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/Gt06ProtocolDecoderTest.java
@@ -15,7 +15,10 @@ public class Gt06ProtocolDecoderTest extends ProtocolDecoderTest {
assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
"787811010123456789012345100B3201000171930D0A"))));
-
+
+ assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
+ "78780a13440604000201baaf540d0a"))));
+
verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
"787823120f081b121d37cb01c8e2cc08afd3c020d50201940701d600a1190041ee100576d1470d0a"))));