aboutsummaryrefslogtreecommitdiff
path: root/test/org/traccar/protocol/BoxProtocolDecoderTest.java
blob: e83b2090ad237153e9e2e98ae51067b032c851c1 (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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package org.traccar.protocol;

import static org.junit.Assert.assertNull;
import org.traccar.helper.TestIdentityManager;
import static org.traccar.helper.DecoderVerifier.verify;
import org.junit.Test;

public class BoxProtocolDecoderTest extends ProtocolDecoderTest {

    @Test
    public void testDecode() throws Exception {

        BoxProtocolDecoder decoder = new BoxProtocolDecoder(new BoxProtocol());
        
        assertNull(decoder.decode(null, null,
                "H,BT,358281002435893,081028142432,F5813D19,6D6E6DC2"));
        
        assertNull(decoder.decode(null, null,
                "H,BT,N878123,080415081234,D63E6DD9,6D6E6DC2,8944100300825505377"));

        verify(decoder.decode(null, null,
                "L,081028142429,G,52.51084,-1.70849,0,170,0,1,0"));

        verify(decoder.decode(null, null,
                "L,081028142432,G,52.51081,-1.70849,0,203,0,16,0"));

        assertNull(decoder.decode(null, null,
                "L,080528112501,AI1,145.56"));

        assertNull(decoder.decode(null, null,
                "E,1"));

        verify(decoder.decode(null, null,
                "L,150728150130,G,24.68312,46.67526,0,140,0,3,20;A,0;D,0;I,0"));

        verify(decoder.decode(null, null,
                "L,150728155815,G,24.68311,46.67528,0,140,0,6,21;A,0;D,0;I,0"));

        verify(decoder.decode(null, null,
                "L,150728155833,G,24.68311,46.67528,11,140,0,52,23;A,0.79;D,0;I,0"));

        verify(decoder.decode(null, null,
                "L,150728155934,G,24.68396,46.67489,0,282,0.12,1,21;A,1.27;D,1.23;I,0"));

        verify(decoder.decode(null, null,
                "L,150728160033,G,24.68414,46.67485,0,282,0.12,1,21;A,0;D,0;I,0"));

        verify(decoder.decode(null, null,
                "L,150728160133,G,24.68388,46.675,0,282,0.12,1,21;A,0;D,0;I,0"));

        verify(decoder.decode(null, null,
                "L,150728160233,G,24.68377,46.67501,0,282,0.12,1,21;A,0;D,0;I,0"));

        verify(decoder.decode(null, null,
                "L,150728160333,G,24.684,46.67488,0,282,0.12,1,21;A,0;D,0;I,0"));

        verify(decoder.decode(null, null,
                "L,150728155855,G,24.68413,46.67482,0,282,0.14,53,21;A,0;D,0;I,0"));

        verify(decoder.decode(null, null,
                "L,150728160400,G,24.68413,46.67482,0,282,0.14,7,20;A,0;D,0;I,0;END,25,326,150728155814"));

    }

}