aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-03-12 19:42:53 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2016-03-12 19:42:53 +1300
commitf96a9f1b6f53ad8a25167360ca4545a83c24cac7 (patch)
treebdd29b24a16403b1e8a3d7cd4325391063b34b8a /test
parentab5d21e16ac44957e04da0f06daf148af95e96be (diff)
parent4606737cc07b736f9c8f98ae680b928c94c082c8 (diff)
downloadtrackermap-server-f96a9f1b6f53ad8a25167360ca4545a83c24cac7.tar.gz
trackermap-server-f96a9f1b6f53ad8a25167360ca4545a83c24cac7.tar.bz2
trackermap-server-f96a9f1b6f53ad8a25167360ca4545a83c24cac7.zip
Merge pull request #1725 from hanselsen/master
Minifinder CUSTOM commands
Diffstat (limited to 'test')
-rw-r--r--test/org/traccar/protocol/MiniFinderProtocolEncoderTest.java36
1 files changed, 36 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..524152bb8
--- /dev/null
+++ b/test/org/traccar/protocol/MiniFinderProtocolEncoderTest.java
@@ -0,0 +1,36 @@
+package org.traccar.protocol;
+
+import org.junit.Before;
+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.TYPE_CUSTOM);
+ command.set("raw", expected);
+ 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;
+ }
+
+}