blob: 7beb52b51e6acec3b3b6fd472cf797d427dff3a9 (
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
|
package org.traccar.protocol;
import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.traccar.ProtocolTest;
import org.traccar.model.Command;
public class MiniFinderProtocolEncoderTest extends ProtocolTest {
private String prefix = "123456";
private MiniFinderProtocolEncoder encoder;
@Before
public void setup() {
encoder = new MiniFinderProtocolEncoder();
}
@Test
public void testEncodeCustom() throws Exception {
String expected = String.format("%sM,700", prefix);
Command command = new Command();
command.setType(Command.CUSTOM);
command.set(expected, 1);
Object encoded = encoder.encodeCommand(command);
assert expected.equals(encoded);
}
@Test
public void testEncodeUnsupportedCommand() throws Exception {
Command command = new Command();
command.setType("UNSUPPORTED");
Object o = encoder.encodeCommand(command);
assert o == null;
}
}
|