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;

public class NavigilProtocolDecoderTest {

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

    }

}

@@ -162,45 +162,31 @@
 org.
-traccar.helper.DecoderVerifier.verify
+junit.Assert.assertNull
 ;%0Aim
@@ -182,39 +182,32 @@
 ertNull;%0Aimport 
-static 
 org.junit.Assert
@@ -204,48 +204,115 @@
 nit.
-Assert.assertNull;%0Aimport org.junit.Test
+Test;%0Aimport org.traccar.helper.ChannelBufferTools;%0Aimport static org.traccar.helper.DecoderVerifier.verify
 ;%0A%0Ap
@@ -516,16 +516,24 @@
  null);%0A
+        
 %0A       
@@ -537,21 +537,158 @@
     
-byte%5B%5D buf1 =
+assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertArray(%0A                new int%5B%5D
  %7B0x
@@ -735,22 +735,16 @@
 00,0x00,
-(byte)
 0xf6,0x0
@@ -769,25 +769,13 @@
 x00,
-(byte)0xe7,(byte)
+0xe7,
 0xcd
@@ -837,32 +837,36 @@
 ,0x00,0x00,0x00%7D
+))))
 ;%0A        assert
@@ -855,34 +855,39 @@
 ));%0A        
-assertNull
+%0A        verify
 (decoder.dec
@@ -960,39 +960,66 @@
 AN, 
-buf1)));%0A%0A        byte%5B%5D buf2 =
+ChannelBufferTools.convertArray(%0A                new int%5B%5D
  %7B0x
@@ -1026,22 +1026,16 @@
 01,0x00,
-(byte)
 0xb3,0x0
@@ -1070,25 +1070,13 @@
 x00,
-(byte)0xf4,(byte)
+0xf4,
 0xa8
@@ -1096,22 +1096,16 @@
 02,0x00,
-(byte)
 0xca,0x0
@@ -1120,58 +1120,28 @@
 x51,
-(byte)0xef,(byte)0x88,(byte)0x85,(byte)0xf0,(byte)
+0xef,0x88,0x85,0xf0,
 0xb8
@@ -1170,14 +1170,8 @@
 x00,
-(byte)
 0xc0
@@ -1200,110 +1200,9 @@
 x00%7D
-;%0A        verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, buf2
+)
 )));

Update Navigil unit test