diff options
Diffstat (limited to 'test/org/traccar/protocol/Gt02ProtocolDecoderTest.java')
-rw-r--r-- | test/org/traccar/protocol/Gt02ProtocolDecoderTest.java | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/test/org/traccar/protocol/Gt02ProtocolDecoderTest.java b/test/org/traccar/protocol/Gt02ProtocolDecoderTest.java index 54a5d90c3..8d537685e 100644 --- a/test/org/traccar/protocol/Gt02ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/Gt02ProtocolDecoderTest.java @@ -1,9 +1,11 @@ package org.traccar.protocol; -import org.traccar.helper.TestDataManager; 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.helper.ChannelBufferTools; +import static org.traccar.helper.DecoderVerifier.verify; +import org.traccar.helper.TestDataManager; public class Gt02ProtocolDecoderTest { @@ -12,9 +14,15 @@ public class Gt02ProtocolDecoderTest { Gt02ProtocolDecoder decoder = new Gt02ProtocolDecoder(null); decoder.setDataManager(new TestDataManager()); - - byte[] buf1 = {0x68,0x68,0x25,0x00,0x00,0x01,0x23,0x45,0x67,(byte)0x89,0x01,0x23,0x45,0x00,0x01,0x10,0x01,0x01,0x01,0x01,0x01,0x01,0x02,0x6B,0x3F,0x3E,0x02,0x6B,0x3F,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x0D,0x0A}; - verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(buf1))); + + verify(decoder.decode(null, null, 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})))); + + assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray( + new int[] {0x68,0x68,0x11,0x06,0x03,0x03,0x58,0x89,0x90,0x51,0x01,0x27,0x66,0x00,0x00,0x1a,0x04,0x02,0x29,0x2d,0x0d,0x0a})))); + + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray( + new int[] {0x68,0x68,0x25,0x00,0xa4,0x03,0x58,0x89,0x90,0x51,0x01,0x27,0x66,0x00,0x01,0x10,0x0e,0x09,0x06,0x0a,0x1d,0x1b,0x00,0xad,0xe1,0xc9,0x0b,0x79,0xea,0x30,0x00,0x01,0x1b,0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x0d,0x0a})))); } |