diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-10-11 13:50:13 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-10-11 13:50:13 +1300 |
commit | aa289b8600d9a55fdd053e003705de116ab25f2e (patch) | |
tree | 4d778f5b001f7eedc10dfae46603c92611fa8fe5 /test/org | |
parent | 16f2679a18d00270bd733292a11c67b38458bf7b (diff) | |
download | trackermap-server-aa289b8600d9a55fdd053e003705de116ab25f2e.tar.gz trackermap-server-aa289b8600d9a55fdd053e003705de116ab25f2e.tar.bz2 trackermap-server-aa289b8600d9a55fdd053e003705de116ab25f2e.zip |
Make changes to model hierarchy
Diffstat (limited to 'test/org')
-rw-r--r-- | test/org/traccar/helper/DecoderVerifier.java | 25 | ||||
-rw-r--r-- | test/org/traccar/protocol/Gt06ProtocolDecoderTest.java | 5 |
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")))); |