diff options
Diffstat (limited to 'test/org/traccar/protocol/Tk103ProtocolEncoderTest.java')
-rw-r--r-- | test/org/traccar/protocol/Tk103ProtocolEncoderTest.java | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/test/org/traccar/protocol/Tk103ProtocolEncoderTest.java b/test/org/traccar/protocol/Tk103ProtocolEncoderTest.java index 565f6bb88..34b2acf86 100644 --- a/test/org/traccar/protocol/Tk103ProtocolEncoderTest.java +++ b/test/org/traccar/protocol/Tk103ProtocolEncoderTest.java @@ -9,6 +9,20 @@ import static org.junit.Assert.assertEquals; public class Tk103ProtocolEncoderTest extends ProtocolTest { @Test + public void testEncodeOutputControl() { + + Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(); + + Command command = new Command(); + command.setDeviceId(1); + command.setType(Command.TYPE_OUTPUT_CONTROL); + command.set(Command.KEY_DATA, "1"); + + assertEquals("(123456789012345AV001)", encoder.encodeCommand(command)); + + } + + @Test public void testEncodeEngineStop() throws Exception { Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(); @@ -207,6 +221,20 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest { } @Test + public void testEncodeCustom() throws Exception { + + Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(); + + Command command = new Command(); + command.setDeviceId(1); + command.setType(Command.TYPE_CUSTOM); + command.set(Command.KEY_DATA, "AA00"); + + assertEquals("(123456789012345AA00)", encoder.encodeCommand(command)); + + } + + @Test public void testEncodeCustomAlternative() throws Exception { Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(true); |