aboutsummaryrefslogtreecommitdiff
path: root/test/org/traccar/protocol/NoranProtocolDecoderTest.java
blob: 4742cf7309c2d6db52d92d3e208a8f4e2a798061 (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
27
28
29
package org.traccar.protocol;

import java.nio.ByteOrder;
import org.traccar.helper.TestDataManager;
import org.jboss.netty.buffer.ChannelBuffers;
import static org.junit.Assert.assertNull;
import static org.traccar.helper.DecoderVerifier.verify;
import org.junit.Test;
import org.traccar.helper.ChannelBufferTools;

public class NoranProtocolDecoderTest {

    @Test
    public void testDecode() throws Exception {

        NoranProtocolDecoder decoder = new NoranProtocolDecoder(new TestDataManager(), null, null);

        assertNull(decoder.decode(null, null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertArray(
                new int[] {0x0f,0x00,0x00,0x00,0x4e,0x52,0x30,0x39,0x46,0x30,0x34,0x31,0x35,0x35,0x00}))));

        verify(decoder.decode(null, null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertArray(
                new int[] {0x22,0x00,0x08,0x00,0x01,0x0c,0x00,0x8a,0x00,0x7e,0x9d,0xaa,0x42,0x31,0x7b,0xdd,0x41,0xa7,0xf3,0xe2,0x38,0x4e,0x52,0x30,0x39,0x46,0x30,0x34,0x31,0x35,0x35,0x00,0x00,0x00}))));

        verify(decoder.decode(null, null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertArray(
                new int[] {0x34,0x00,0x08,0x00,0x01,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x1c,0x42,0x91,0x25,0x11,0x43,0x38,0x8d,0x17,0xc2,0x4e,0x52,0x30,0x39,0x42,0x31,0x31,0x30,0x39,0x30,0x00,0x00,0x31,0x34,0x2d,0x31,0x32,0x2d,0x32,0x35,0x20,0x30,0x30,0x3a,0x33,0x33,0x3a,0x30,0x37,0x00}))));

    }

}