aboutsummaryrefslogtreecommitdiff
path: root/test/org/traccar
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2014-09-07 13:41:51 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2014-09-07 13:41:51 +1200
commit9bad8efca5f64b60d5525b3858f42ac6cd6be272 (patch)
treead23087bf468f212fa3ec59327b54d507163fa74 /test/org/traccar
parent8742c6e9ef538f30531ec3d4245c8e0f59f211f9 (diff)
downloadtraccar-server-9bad8efca5f64b60d5525b3858f42ac6cd6be272.tar.gz
traccar-server-9bad8efca5f64b60d5525b3858f42ac6cd6be272.tar.bz2
traccar-server-9bad8efca5f64b60d5525b3858f42ac6cd6be272.zip
Update GT02 unit test
Diffstat (limited to 'test/org/traccar')
-rw-r--r--test/org/traccar/protocol/Gt02ProtocolDecoderTest.java18
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}))));
}