aboutsummaryrefslogtreecommitdiff
path: root/test/org/traccar/protocol/NavigilProtocolDecoderTest.java
blob: 6b71d4d536e82c76cb8acee2e515d76c0cb198b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package org.traccar.protocol;

import org.traccar.helper.TestDataManager;
import java.nio.ByteOrder;
import org.jboss.netty.buffer.ChannelBuffers;
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 {

    @Test
    public void testDecode() throws Exception {

        NavigilProtocolDecoder decoder = new NavigilProtocolDecoder(new TestDataManager(), null, null);
        
        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}))));

    }

}