aboutsummaryrefslogtreecommitdiff
path: root/test/org/traccar/protocol/Gps103ProtocolEncoderTest.java
blob: 5060c576aa019d04d3453fdb3ea5dbe5a5684da1 (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.util.HashMap;
import java.util.Map;
import org.junit.Assert;
import org.junit.Test;
import org.traccar.model.Command;

public class Gps103ProtocolEncoderTest {

    @Test
    public void testDecode() throws Exception {

        Gps103ProtocolEncoder encoder = new Gps103ProtocolEncoder();
        
        Command command = new Command();
        command.setDeviceId(1);
        command.setType(Command.TYPE_POSITION_FIX);
        
        Map<String, Object> other = new HashMap<>();
        other.put(Command.KEY_FREQUENCY, 300l);
        
        command.setOther(other);
        
        Assert.assertEquals("**,imei:123456789012345,C,05m;", encoder.encodeCommand(command));

    }

}