aboutsummaryrefslogtreecommitdiff
path: root/test/org/traccar/protocol/Gps103ProtocolEncoderTest.java
blob: 1fd93ede4ddc2ada5d8bc28a06716d3f380d3e47 (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_PERIODIC);
        
        Map<String, Object> other = new HashMap<>();
        other.put(Command.KEY_FREQUENCY, 300l);
        
        command.setOther(other);
        
        Assert.assertEquals("**,imei:123456789012345,C,05m;", encoder.encodeCommand(command));

    }

}