package org.traccar.protocol;

import org.traccar.helper.TestDataManager;
import org.jboss.netty.buffer.ChannelBuffers;
import static org.traccar.helper.DecoderVerifier.verify;
import org.junit.Test;

public class Gt02ProtocolDecoderTest {

    @Test
    public void testDecode() throws Exception {

        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)));

    }

}

@@ -39,67 +39,132 @@
 org.
-traccar.helper.Te
+jboss.netty.buffer.ChannelBuffers;%0Aimport 
 st
-D
 at
-aManager;%0Aimport org.jboss.netty.buff
+ic org.junit.Assert.assertNull;%0Aimport org.junit.Test;%0Aimport org.traccar.help
 er.C
@@ -167,32 +167,36 @@
 er.ChannelBuffer
+Tool
 s;%0Aimport static
@@ -250,26 +250,46 @@
 ort org.
-junit.Test
+traccar.helper.TestDataManager
 ;%0A%0Apubli
@@ -502,24 +502,32 @@
 Manager());%0A
+        
 %0A        byt
@@ -527,21 +527,129 @@
     
-byte%5B%5D buf1 =
+verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray(%0A                new int%5B%5D
  %7B0x
@@ -695,14 +695,8 @@
 x67,
-(byte)
 0x89
@@ -856,16 +856,20 @@
 0D,0x0A%7D
+))))
 ;%0A      
@@ -874,75 +874,611 @@
     
-verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(buf1
+%0A        assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray(%0A                new int%5B%5D %7B0x68,0x68,0x11,0x06,0x03,0x03,0x58,0x89,0x90,0x51,0x01,0x27,0x66,0x00,0x00,0x1a,0x04,0x02,0x29,0x2d,0x0d,0x0a%7D))));%0A        %0A        verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray(%0A                new int%5B%5D %7B0x68,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%7D)
 )));

Update GT02 unit test