From faaf63abdd81d1d4b6e7c7a8ef36e049fdc8000a Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Fri, 17 Jul 2015 22:41:03 +1200 Subject: Finish with GPS103 commands --- .../protocol/Gps103ProtocolEncoderTest.java | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 test/org/traccar/protocol/Gps103ProtocolEncoderTest.java (limited to 'test/org/traccar/protocol') diff --git a/test/org/traccar/protocol/Gps103ProtocolEncoderTest.java b/test/org/traccar/protocol/Gps103ProtocolEncoderTest.java new file mode 100644 index 000000000..74091d0e0 --- /dev/null +++ b/test/org/traccar/protocol/Gps103ProtocolEncoderTest.java @@ -0,0 +1,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 other = new HashMap<>(); + other.put(Command.KEY_FREQUENCY, 300l); + + command.setOther(other); + + Assert.assertEquals("**,imei:123456789012345,C,05m", encoder.encodeCommand(command)); + + } + +} -- cgit v1.2.3