diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2014-12-22 21:39:10 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2014-12-22 21:39:10 +1300 |
commit | 236cf16939a6e0b4c5268926733ced6235dec70d (patch) | |
tree | c43bf278377192bb4861463b325a9cc65ab99518 /test/org/traccar/protocol | |
parent | 0e22ee92528ed1a1ec76f536881928c4f7b78042 (diff) | |
download | trackermap-server-236cf16939a6e0b4c5268926733ced6235dec70d.tar.gz trackermap-server-236cf16939a6e0b4c5268926733ced6235dec70d.tar.bz2 trackermap-server-236cf16939a6e0b4c5268926733ced6235dec70d.zip |
Update Navigil unit test
Diffstat (limited to 'test/org/traccar/protocol')
-rw-r--r-- | test/org/traccar/protocol/NavigilProtocolDecoderTest.java | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/test/org/traccar/protocol/NavigilProtocolDecoderTest.java b/test/org/traccar/protocol/NavigilProtocolDecoderTest.java index cf3372313..6b71d4d53 100644 --- a/test/org/traccar/protocol/NavigilProtocolDecoderTest.java +++ b/test/org/traccar/protocol/NavigilProtocolDecoderTest.java @@ -3,9 +3,10 @@ package org.traccar.protocol; import org.traccar.helper.TestDataManager; 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; +import org.traccar.helper.ChannelBufferTools; +import static org.traccar.helper.DecoderVerifier.verify; public class NavigilProtocolDecoderTest { @@ -13,12 +14,12 @@ public class NavigilProtocolDecoderTest { public void testDecode() throws Exception { NavigilProtocolDecoder decoder = new NavigilProtocolDecoder(new TestDataManager(), null, null); - - byte[] buf1 = {0x01,0x00,0x43,0x00,0x04,0x00,0x20,0x00,0x00,0x00,(byte)0xf6,0x02,0x03,0x08,0x02,0x00,(byte)0xe7,(byte)0xcd,0x0f,0x51,0x0c,0x00,0x00,0x00,0x3b,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; - assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, buf1))); - - byte[] buf2 = {0x01,0x00,(byte)0xb3,0x00,0x0f,0x00,0x24,0x00,0x00,0x00,(byte)0xf4,(byte)0xa8,0x03,0x08,0x02,0x00,(byte)0xca,0x0c,0x11,0x51,(byte)0xef,(byte)0x88,(byte)0x85,(byte)0xf0,(byte)0xb8,0x2e,0x6d,0x13,0x04,0x00,(byte)0xc0,0x04,0x03,0x00,0x00,0x00}; - verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, buf2))); + + assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertArray( + new int[] {0x01,0x00,0x43,0x00,0x04,0x00,0x20,0x00,0x00,0x00,0xf6,0x02,0x03,0x08,0x02,0x00,0xe7,0xcd,0x0f,0x51,0x0c,0x00,0x00,0x00,0x3b,0x00,0x00,0x00,0x00,0x00,0x00,0x00})))); + + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertArray( + new int[] {0x01,0x00,0xb3,0x00,0x0f,0x00,0x24,0x00,0x00,0x00,0xf4,0xa8,0x03,0x08,0x02,0x00,0xca,0x0c,0x11,0x51,0xef,0x88,0x85,0xf0,0xb8,0x2e,0x6d,0x13,0x04,0x00,0xc0,0x04,0x03,0x00,0x00,0x00})))); } |