diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2014-10-22 16:37:13 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2014-10-22 16:37:13 +1300 |
commit | 435ae8233c3cca5da88c4ba774b90aff780e9b88 (patch) | |
tree | c35e5102a5ab3ee1e8c10120bd8f69bfa762102c /test/org/traccar/protocol/H02ProtocolDecoderTest.java | |
parent | 5490a0351abc9d6e741baf129300beb2d50051fd (diff) | |
download | trackermap-server-435ae8233c3cca5da88c4ba774b90aff780e9b88.tar.gz trackermap-server-435ae8233c3cca5da88c4ba774b90aff780e9b88.tar.bz2 trackermap-server-435ae8233c3cca5da88c4ba774b90aff780e9b88.zip |
Add unit tests
Diffstat (limited to 'test/org/traccar/protocol/H02ProtocolDecoderTest.java')
-rw-r--r-- | test/org/traccar/protocol/H02ProtocolDecoderTest.java | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/test/org/traccar/protocol/H02ProtocolDecoderTest.java b/test/org/traccar/protocol/H02ProtocolDecoderTest.java index d1800f3f3..09b55d816 100644 --- a/test/org/traccar/protocol/H02ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/H02ProtocolDecoderTest.java @@ -74,21 +74,24 @@ public class H02ProtocolDecoderTest { 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()))); - int[] buf1 = {0x24,0x27,0x05,0x17,0x11,0x09,0x21,0x33,0x39,0x14,0x06,0x13,0x50,0x02,0x58,0x49,0x00,0x01,0x43,0x37,0x82,0x2e,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0x00,0x00}; - verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray(buf1)))); + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray( + new int[]{0x24,0x27,0x05,0x17,0x11,0x09,0x21,0x33,0x39,0x14,0x06,0x13,0x50,0x02,0x58,0x49,0x00,0x01,0x43,0x37,0x82,0x2e,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0x00,0x00})))); - int[] buf2 = {0x24,0x27,0x05,0x17,0x11,0x09,0x21,0x34,0x09,0x14,0x06,0x13,0x50,0x02,0x58,0x49,0x00,0x01,0x43,0x37,0x82,0x2e,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0x00,0x00}; - verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray(buf2)))); + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray( + new int[]{0x24,0x27,0x05,0x17,0x11,0x09,0x21,0x34,0x09,0x14,0x06,0x13,0x50,0x02,0x58,0x49,0x00,0x01,0x43,0x37,0x82,0x2e,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0x00,0x00})))); - int[] buf3 = {0x24,0x10,0x30,0x73,0x10,0x01,0x05,0x03,0x16,0x22,0x09,0x02,0x22,0x12,0x87,0x45,0x00,0x11,0x34,0x66,0x57,0x4C,0x01,0x40,0x28,0xff,0xff,0xfb,0xff,0xff,0x00,0x00}; - verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray(buf3)))); + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray( + new int[]{0x24,0x10,0x30,0x73,0x10,0x01,0x05,0x03,0x16,0x22,0x09,0x02,0x22,0x12,0x87,0x45,0x00,0x11,0x34,0x66,0x57,0x4C,0x01,0x40,0x28,0xff,0xff,0xfb,0xff,0xff,0x00,0x00})))); - int[] buf4 = {0x24,0x41,0x09,0x00,0x13,0x45,0x08,0x31,0x25,0x04,0x01,0x14,0x50,0x47,0x88,0x80,0x00,0x00,0x85,0x54,0x65,0x0e,0x00,0x00,0x00,0xff,0xff,0xf9,0xff,0xff,0x00,0x10,0x06,0x00,0x00,0x00,0x00,0x01,0x06,0x02,0x02,0x99,0x10,0x9c,0x01}; - verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray(buf4)))); + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray( + new int[]{0x24,0x41,0x09,0x00,0x13,0x45,0x08,0x31,0x25,0x04,0x01,0x14,0x50,0x47,0x88,0x80,0x00,0x00,0x85,0x54,0x65,0x0e,0x00,0x00,0x00,0xff,0xff,0xf9,0xff,0xff,0x00,0x10,0x06,0x00,0x00,0x00,0x00,0x01,0x06,0x02,0x02,0x99,0x10,0x9c,0x01})))); - int[] buf5 = {0x24,0x27,0x05,0x17,0x03,0x08,0x20,0x32,0x14,0x18,0x04,0x14,0x23,0x30,0x78,0x79,0x00,0x04,0x63,0x21,0x37,0x92,0x00,0x00,0x56,0xff,0xff,0xf9,0xff,0xff,0x00,0x00}; - verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray(buf5)))); + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray( + new int[]{0x24,0x27,0x05,0x17,0x03,0x08,0x20,0x32,0x14,0x18,0x04,0x14,0x23,0x30,0x78,0x79,0x00,0x04,0x63,0x21,0x37,0x92,0x00,0x00,0x56,0xff,0xff,0xf9,0xff,0xff,0x00,0x00})))); } |