aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorHans van den Elsen <hans.elsen@esds.nl>2016-02-13 16:13:18 +0100
committerHans van den Elsen <hans.elsen@esds.nl>2016-02-13 16:13:18 +0100
commit8622ba6e081b987a96e3b1885209576f3c389266 (patch)
treea7fdac02b5144d2feb2348c1bc244a66e2b0f099 /test
parent5a4562f8e53e4e00a610c9715786f70a743067b5 (diff)
downloadtraccar-server-8622ba6e081b987a96e3b1885209576f3c389266.tar.gz
traccar-server-8622ba6e081b987a96e3b1885209576f3c389266.tar.bz2
traccar-server-8622ba6e081b987a96e3b1885209576f3c389266.zip
Added objectEncoder for Minifinder protocol
Diffstat (limited to 'test')
-rw-r--r--test/org/traccar/protocol/MiniFinderProtocolEncoderTest.java38
1 files changed, 38 insertions, 0 deletions
diff --git a/test/org/traccar/protocol/MiniFinderProtocolEncoderTest.java b/test/org/traccar/protocol/MiniFinderProtocolEncoderTest.java
new file mode 100644
index 000000000..7beb52b51
--- /dev/null
+++ b/test/org/traccar/protocol/MiniFinderProtocolEncoderTest.java
@@ -0,0 +1,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;
+ }
+
+}