diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2019-07-16 21:30:07 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-16 21:30:07 -0700 |
commit | 8e8ad84ca04173a8691ecf2202a8cf4cfbc7bba2 (patch) | |
tree | b1471afd93cf84373926dea2c2cff01aabaf83b6 /src/test/java | |
parent | 4c4fb4d90a1aeb1acbdfd11516644b1a149605bd (diff) | |
parent | 9d28f527e9674060937da3dad24b079a6e8d530e (diff) | |
download | traccar-server-8e8ad84ca04173a8691ecf2202a8cf4cfbc7bba2.tar.gz traccar-server-8e8ad84ca04173a8691ecf2202a8cf4cfbc7bba2.tar.bz2 traccar-server-8e8ad84ca04173a8691ecf2202a8cf4cfbc7bba2.zip |
Merge pull request #4356 from edvalley/proposed-2
Pass a Protocol object to encoders
Diffstat (limited to 'src/test/java')
31 files changed, 92 insertions, 92 deletions
diff --git a/src/test/java/org/traccar/protocol/AdmProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/AdmProtocolEncoderTest.java index cb0a31ceb..fd6214c57 100644 --- a/src/test/java/org/traccar/protocol/AdmProtocolEncoderTest.java +++ b/src/test/java/org/traccar/protocol/AdmProtocolEncoderTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2017 Anton Tananaev (anton@traccar.org) + * Copyright 2017 - 2019 Anton Tananaev (anton@traccar.org) * Copyright 2017 Anatoliy Golubev (darth.naihil@gmail.com) * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -27,7 +27,7 @@ public class AdmProtocolEncoderTest extends ProtocolTest { @Test public void testEncode() throws Exception { - AdmProtocolEncoder encoder = new AdmProtocolEncoder(); + AdmProtocolEncoder encoder = new AdmProtocolEncoder(null); Command command = new Command(); command.setDeviceId(1); diff --git a/src/test/java/org/traccar/protocol/BceProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/BceProtocolEncoderTest.java index bdcc1f9e8..be5877193 100644 --- a/src/test/java/org/traccar/protocol/BceProtocolEncoderTest.java +++ b/src/test/java/org/traccar/protocol/BceProtocolEncoderTest.java @@ -9,8 +9,8 @@ public class BceProtocolEncoderTest extends ProtocolTest { @Test public void testEncode() throws Exception { - BceProtocolEncoder encoder = new BceProtocolEncoder(); - + BceProtocolEncoder encoder = new BceProtocolEncoder(null); + Command command = new Command(); command.setDeviceId(1); command.setType(Command.TYPE_OUTPUT_CONTROL); diff --git a/src/test/java/org/traccar/protocol/CastelProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/CastelProtocolEncoderTest.java index bcb93a010..1864d9e84 100644 --- a/src/test/java/org/traccar/protocol/CastelProtocolEncoderTest.java +++ b/src/test/java/org/traccar/protocol/CastelProtocolEncoderTest.java @@ -9,8 +9,8 @@ public class CastelProtocolEncoderTest extends ProtocolTest { @Test public void testEncode() throws Exception { - CastelProtocolEncoder encoder = new CastelProtocolEncoder(); - + CastelProtocolEncoder encoder = new CastelProtocolEncoder(null); + Command command = new Command(); command.setDeviceId(1); command.setType(Command.TYPE_ENGINE_STOP); diff --git a/src/test/java/org/traccar/protocol/CellocatorProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/CellocatorProtocolEncoderTest.java index 89850fb5f..616640116 100644 --- a/src/test/java/org/traccar/protocol/CellocatorProtocolEncoderTest.java +++ b/src/test/java/org/traccar/protocol/CellocatorProtocolEncoderTest.java @@ -11,8 +11,8 @@ public class CellocatorProtocolEncoderTest extends ProtocolTest { @Test public void testEncode() throws Exception { - CellocatorProtocolEncoder encoder = new CellocatorProtocolEncoder(); - + CellocatorProtocolEncoder encoder = new CellocatorProtocolEncoder(null); + Command command = new Command(); command.setDeviceId(1); command.setType(Command.TYPE_OUTPUT_CONTROL); diff --git a/src/test/java/org/traccar/protocol/CityeasyProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/CityeasyProtocolEncoderTest.java index 7c03b7d5b..f0eede4bf 100644 --- a/src/test/java/org/traccar/protocol/CityeasyProtocolEncoderTest.java +++ b/src/test/java/org/traccar/protocol/CityeasyProtocolEncoderTest.java @@ -9,7 +9,7 @@ public class CityeasyProtocolEncoderTest extends ProtocolTest { @Test public void testEncode() throws Exception { - CityeasyProtocolEncoder encoder = new CityeasyProtocolEncoder(); + CityeasyProtocolEncoder encoder = new CityeasyProtocolEncoder(null); Command command = new Command(); command.setDeviceId(1); diff --git a/src/test/java/org/traccar/protocol/EelinkProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/EelinkProtocolEncoderTest.java index e4502f919..616ca0b52 100644 --- a/src/test/java/org/traccar/protocol/EelinkProtocolEncoderTest.java +++ b/src/test/java/org/traccar/protocol/EelinkProtocolEncoderTest.java @@ -13,9 +13,9 @@ public class EelinkProtocolEncoderTest extends ProtocolTest { command.setDeviceId(1); command.setType(Command.TYPE_ENGINE_STOP); - verifyCommand(new EelinkProtocolEncoder(false), command, binary("676780000f0000010000000052454c41592c3123")); + verifyCommand(new EelinkProtocolEncoder(null, false), command, binary("676780000f0000010000000052454c41592c3123")); - verifyCommand(new EelinkProtocolEncoder(true), command, binary("454c001eb41a0123456789012345676780000f0000010000000052454c41592c3123")); + verifyCommand(new EelinkProtocolEncoder(null, true), command, binary("454c001eb41a0123456789012345676780000f0000010000000052454c41592c3123")); } diff --git a/src/test/java/org/traccar/protocol/EsealProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/EsealProtocolEncoderTest.java index 16f00d69b..7bf4f844e 100644 --- a/src/test/java/org/traccar/protocol/EsealProtocolEncoderTest.java +++ b/src/test/java/org/traccar/protocol/EsealProtocolEncoderTest.java @@ -11,7 +11,7 @@ public class EsealProtocolEncoderTest extends ProtocolTest { @Test public void testEncode() throws Exception { - EsealProtocolEncoder encoder = new EsealProtocolEncoder(); + EsealProtocolEncoder encoder = new EsealProtocolEncoder(null); Command command = new Command(); command.setDeviceId(1); diff --git a/src/test/java/org/traccar/protocol/FifotrackProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/FifotrackProtocolEncoderTest.java index 53ae8510a..b60313956 100644 --- a/src/test/java/org/traccar/protocol/FifotrackProtocolEncoderTest.java +++ b/src/test/java/org/traccar/protocol/FifotrackProtocolEncoderTest.java @@ -11,8 +11,8 @@ public class FifotrackProtocolEncoderTest extends ProtocolTest { @Test public void testEncode() throws Exception { - FifotrackProtocolEncoder encoder = new FifotrackProtocolEncoder(); - + FifotrackProtocolEncoder encoder = new FifotrackProtocolEncoder(null); + Command command = new Command(); command.setDeviceId(1); command.setType(Command.TYPE_REQUEST_PHOTO); diff --git a/src/test/java/org/traccar/protocol/GalileoProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/GalileoProtocolEncoderTest.java index 34423578d..6a68752bb 100644 --- a/src/test/java/org/traccar/protocol/GalileoProtocolEncoderTest.java +++ b/src/test/java/org/traccar/protocol/GalileoProtocolEncoderTest.java @@ -9,7 +9,7 @@ public class GalileoProtocolEncoderTest extends ProtocolTest { @Test public void testEncode() throws Exception { - GalileoProtocolEncoder encoder = new GalileoProtocolEncoder(); + GalileoProtocolEncoder encoder = new GalileoProtocolEncoder(null); Command command = new Command(); command.setDeviceId(1); diff --git a/src/test/java/org/traccar/protocol/Gps103ProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/Gps103ProtocolEncoderTest.java index f888ee252..23a05fcee 100644 --- a/src/test/java/org/traccar/protocol/Gps103ProtocolEncoderTest.java +++ b/src/test/java/org/traccar/protocol/Gps103ProtocolEncoderTest.java @@ -11,13 +11,13 @@ public class Gps103ProtocolEncoderTest extends ProtocolTest { @Test public void testEncodePositionPeriodic() throws Exception { - Gps103ProtocolEncoder encoder = new Gps103ProtocolEncoder(); - + Gps103ProtocolEncoder encoder = new Gps103ProtocolEncoder(null); + Command command = new Command(); command.setDeviceId(1); command.setType(Command.TYPE_POSITION_PERIODIC); command.set(Command.KEY_FREQUENCY, 300); - + assertEquals("**,imei:123456789012345,C,05m", encoder.encodeCommand(command)); } @@ -25,7 +25,7 @@ public class Gps103ProtocolEncoderTest extends ProtocolTest { @Test public void testEncodeCustom() throws Exception { - Gps103ProtocolEncoder encoder = new Gps103ProtocolEncoder(); + Gps103ProtocolEncoder encoder = new Gps103ProtocolEncoder(null); Command command = new Command(); command.setDeviceId(1); diff --git a/src/test/java/org/traccar/protocol/Gt06ProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/Gt06ProtocolEncoderTest.java index aceaef434..178c7b763 100644 --- a/src/test/java/org/traccar/protocol/Gt06ProtocolEncoderTest.java +++ b/src/test/java/org/traccar/protocol/Gt06ProtocolEncoderTest.java @@ -9,8 +9,8 @@ public class Gt06ProtocolEncoderTest extends ProtocolTest { @Test public void testEncode() throws Exception { - Gt06ProtocolEncoder encoder = new Gt06ProtocolEncoder(); - + Gt06ProtocolEncoder encoder = new Gt06ProtocolEncoder(null); + Command command = new Command(); command.setDeviceId(1); command.setType(Command.TYPE_ENGINE_STOP); diff --git a/src/test/java/org/traccar/protocol/H02ProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/H02ProtocolEncoderTest.java index a7ce3fc7e..155869b24 100644 --- a/src/test/java/org/traccar/protocol/H02ProtocolEncoderTest.java +++ b/src/test/java/org/traccar/protocol/H02ProtocolEncoderTest.java @@ -14,7 +14,7 @@ import static org.junit.Assert.assertEquals; public class H02ProtocolEncoderTest extends ProtocolTest { - private H02ProtocolEncoder encoder = new H02ProtocolEncoder(); + private H02ProtocolEncoder encoder = new H02ProtocolEncoder(null); private Date time = Date.from( LocalDateTime.of(LocalDate.now(), LocalTime.of(1, 2, 3)).atZone(ZoneOffset.systemDefault()).toInstant()); diff --git a/src/test/java/org/traccar/protocol/HuabaoProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/HuabaoProtocolEncoderTest.java index 771e6d28c..d0a0427c8 100644 --- a/src/test/java/org/traccar/protocol/HuabaoProtocolEncoderTest.java +++ b/src/test/java/org/traccar/protocol/HuabaoProtocolEncoderTest.java @@ -11,8 +11,8 @@ public class HuabaoProtocolEncoderTest extends ProtocolTest { @Test public void testEncode() throws Exception { - HuabaoProtocolEncoder encoder = new HuabaoProtocolEncoder(); - + HuabaoProtocolEncoder encoder = new HuabaoProtocolEncoder(null); + Command command = new Command(); command.setDeviceId(1); command.setType(Command.TYPE_ENGINE_STOP); diff --git a/src/test/java/org/traccar/protocol/ItsProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/ItsProtocolEncoderTest.java index e7c4318b3..225edd643 100644 --- a/src/test/java/org/traccar/protocol/ItsProtocolEncoderTest.java +++ b/src/test/java/org/traccar/protocol/ItsProtocolEncoderTest.java @@ -11,7 +11,7 @@ public class ItsProtocolEncoderTest extends ProtocolTest { @Test public void testEncode() throws Exception { - ItsProtocolEncoder encoder = new ItsProtocolEncoder(); + ItsProtocolEncoder encoder = new ItsProtocolEncoder(null); Command command = new Command(); command.setDeviceId(1); diff --git a/src/test/java/org/traccar/protocol/Jt600ProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/Jt600ProtocolEncoderTest.java index 100d7492a..c0b399c63 100644 --- a/src/test/java/org/traccar/protocol/Jt600ProtocolEncoderTest.java +++ b/src/test/java/org/traccar/protocol/Jt600ProtocolEncoderTest.java @@ -7,7 +7,7 @@ import org.traccar.ProtocolTest; import org.traccar.model.Command; public class Jt600ProtocolEncoderTest extends ProtocolTest { - Jt600ProtocolEncoder encoder = new Jt600ProtocolEncoder(); + Jt600ProtocolEncoder encoder = new Jt600ProtocolEncoder(null); Command command = new Command(); @Test diff --git a/src/test/java/org/traccar/protocol/KhdProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/KhdProtocolEncoderTest.java index ab858041a..390defe6f 100644 --- a/src/test/java/org/traccar/protocol/KhdProtocolEncoderTest.java +++ b/src/test/java/org/traccar/protocol/KhdProtocolEncoderTest.java @@ -9,8 +9,8 @@ public class KhdProtocolEncoderTest extends ProtocolTest { @Test public void testEncode() throws Exception { - KhdProtocolEncoder encoder = new KhdProtocolEncoder(); - + KhdProtocolEncoder encoder = new KhdProtocolEncoder(null); + Command command = new Command(); command.setDeviceId(1); command.setType(Command.TYPE_ENGINE_STOP); diff --git a/src/test/java/org/traccar/protocol/MeiligaoProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/MeiligaoProtocolEncoderTest.java index ee4a869f9..d7aa25be8 100644 --- a/src/test/java/org/traccar/protocol/MeiligaoProtocolEncoderTest.java +++ b/src/test/java/org/traccar/protocol/MeiligaoProtocolEncoderTest.java @@ -9,7 +9,7 @@ public class MeiligaoProtocolEncoderTest extends ProtocolTest { @Test public void testEncode() throws Exception { - MeiligaoProtocolEncoder encoder = new MeiligaoProtocolEncoder(); + MeiligaoProtocolEncoder encoder = new MeiligaoProtocolEncoder(null); Command command = new Command(); command.setDeviceId(1); diff --git a/src/test/java/org/traccar/protocol/MeitrackProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/MeitrackProtocolEncoderTest.java index b63ce5051..2b5054cee 100644 --- a/src/test/java/org/traccar/protocol/MeitrackProtocolEncoderTest.java +++ b/src/test/java/org/traccar/protocol/MeitrackProtocolEncoderTest.java @@ -11,8 +11,8 @@ public class MeitrackProtocolEncoderTest extends ProtocolTest { @Test public void testEncode() throws Exception { - MeitrackProtocolEncoder encoder = new MeitrackProtocolEncoder(); - + MeitrackProtocolEncoder encoder = new MeitrackProtocolEncoder(null); + Command command = new Command(); command.setDeviceId(1); command.setType(Command.TYPE_POSITION_SINGLE); diff --git a/src/test/java/org/traccar/protocol/MiniFinderProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/MiniFinderProtocolEncoderTest.java index e9422da9f..5de1346a2 100644 --- a/src/test/java/org/traccar/protocol/MiniFinderProtocolEncoderTest.java +++ b/src/test/java/org/traccar/protocol/MiniFinderProtocolEncoderTest.java @@ -11,7 +11,7 @@ public class MiniFinderProtocolEncoderTest extends ProtocolTest { @Test public void testEncode() throws Exception { - MiniFinderProtocolEncoder encoder = new MiniFinderProtocolEncoder(); + MiniFinderProtocolEncoder encoder = new MiniFinderProtocolEncoder(null); Command command = new Command(); command.setDeviceId(1); diff --git a/src/test/java/org/traccar/protocol/NoranProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/NoranProtocolEncoderTest.java index 38599e0ba..4991f1371 100644 --- a/src/test/java/org/traccar/protocol/NoranProtocolEncoderTest.java +++ b/src/test/java/org/traccar/protocol/NoranProtocolEncoderTest.java @@ -9,8 +9,8 @@ public class NoranProtocolEncoderTest extends ProtocolTest { @Test public void testEncode() throws Exception { - NoranProtocolEncoder encoder = new NoranProtocolEncoder(); - + NoranProtocolEncoder encoder = new NoranProtocolEncoder(null); + Command command = new Command(); command.setDeviceId(1); command.setType(Command.TYPE_ENGINE_STOP); diff --git a/src/test/java/org/traccar/protocol/PretraceProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/PretraceProtocolEncoderTest.java index 1b2780325..aa08ecea2 100644 --- a/src/test/java/org/traccar/protocol/PretraceProtocolEncoderTest.java +++ b/src/test/java/org/traccar/protocol/PretraceProtocolEncoderTest.java @@ -11,13 +11,13 @@ public class PretraceProtocolEncoderTest extends ProtocolTest { @Test public void testEncodePositionPeriodic() throws Exception { - PretraceProtocolEncoder encoder = new PretraceProtocolEncoder(); - + PretraceProtocolEncoder encoder = new PretraceProtocolEncoder(null); + Command command = new Command(); command.setDeviceId(1); command.setType(Command.TYPE_POSITION_PERIODIC); command.set(Command.KEY_FREQUENCY, 300); - + assertEquals("(123456789012345D221300,300,,^69)", encoder.encodeCommand(command)); } @@ -25,7 +25,7 @@ public class PretraceProtocolEncoderTest extends ProtocolTest { @Test public void testEncodeCustom() throws Exception { - PretraceProtocolEncoder encoder = new PretraceProtocolEncoder(); + PretraceProtocolEncoder encoder = new PretraceProtocolEncoder(null); Command command = new Command(); command.setDeviceId(1); diff --git a/src/test/java/org/traccar/protocol/Pt502ProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/Pt502ProtocolEncoderTest.java index a6c8bb50f..9e4a8a9a0 100644 --- a/src/test/java/org/traccar/protocol/Pt502ProtocolEncoderTest.java +++ b/src/test/java/org/traccar/protocol/Pt502ProtocolEncoderTest.java @@ -11,7 +11,7 @@ public class Pt502ProtocolEncoderTest extends ProtocolTest { @Test public void testEncodeCustom() throws Exception { - Pt502ProtocolEncoder encoder = new Pt502ProtocolEncoder(); + Pt502ProtocolEncoder encoder = new Pt502ProtocolEncoder(null); Command command = new Command(); command.setDeviceId(1); @@ -25,22 +25,22 @@ public class Pt502ProtocolEncoderTest extends ProtocolTest { @Test public void testEncodeOutputControl() throws Exception { - Pt502ProtocolEncoder encoder = new Pt502ProtocolEncoder(); - + Pt502ProtocolEncoder encoder = new Pt502ProtocolEncoder(null); + Command command = new Command(); command.setDeviceId(1); command.setType(Command.TYPE_OUTPUT_CONTROL); command.set(Command.KEY_INDEX, 2); command.set(Command.KEY_DATA, "1"); - + assertEquals("#OPC2,1\r\n", encoder.encodeCommand(command)); } - + @Test public void testEncodeTimezone() throws Exception { - Pt502ProtocolEncoder encoder = new Pt502ProtocolEncoder(); + Pt502ProtocolEncoder encoder = new Pt502ProtocolEncoder(null); Command command = new Command(); command.setDeviceId(1); @@ -55,7 +55,7 @@ public class Pt502ProtocolEncoderTest extends ProtocolTest { @Test public void testEncodeAlarmSpeed() throws Exception { - Pt502ProtocolEncoder encoder = new Pt502ProtocolEncoder(); + Pt502ProtocolEncoder encoder = new Pt502ProtocolEncoder(null); Command command = new Command(); command.setDeviceId(1); diff --git a/src/test/java/org/traccar/protocol/RuptelaProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/RuptelaProtocolEncoderTest.java index 8a00caa09..5868b07df 100644 --- a/src/test/java/org/traccar/protocol/RuptelaProtocolEncoderTest.java +++ b/src/test/java/org/traccar/protocol/RuptelaProtocolEncoderTest.java @@ -9,8 +9,8 @@ public class RuptelaProtocolEncoderTest extends ProtocolTest { @Test public void testEncode() throws Exception { - RuptelaProtocolEncoder encoder = new RuptelaProtocolEncoder(); - + RuptelaProtocolEncoder encoder = new RuptelaProtocolEncoder(null); + Command command = new Command(); command.setDeviceId(1); command.setType(Command.TYPE_CUSTOM); diff --git a/src/test/java/org/traccar/protocol/T800xProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/T800xProtocolEncoderTest.java index e41b91281..683aa9d80 100644 --- a/src/test/java/org/traccar/protocol/T800xProtocolEncoderTest.java +++ b/src/test/java/org/traccar/protocol/T800xProtocolEncoderTest.java @@ -9,8 +9,8 @@ public class T800xProtocolEncoderTest extends ProtocolTest { @Test public void testEncode() throws Exception { - T800xProtocolEncoder encoder = new T800xProtocolEncoder(); - + T800xProtocolEncoder encoder = new T800xProtocolEncoder(null); + Command command = new Command(); command.setDeviceId(1); command.setType(Command.TYPE_CUSTOM); diff --git a/src/test/java/org/traccar/protocol/TeltonikaProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/TeltonikaProtocolEncoderTest.java index 5dc78c012..0318b9896 100644 --- a/src/test/java/org/traccar/protocol/TeltonikaProtocolEncoderTest.java +++ b/src/test/java/org/traccar/protocol/TeltonikaProtocolEncoderTest.java @@ -9,8 +9,8 @@ public class TeltonikaProtocolEncoderTest extends ProtocolTest { @Test public void testEncode() throws Exception { - TeltonikaProtocolEncoder encoder = new TeltonikaProtocolEncoder(); - + TeltonikaProtocolEncoder encoder = new TeltonikaProtocolEncoder(null); + Command command = new Command(); command.setDeviceId(1); command.setType(Command.TYPE_CUSTOM); diff --git a/src/test/java/org/traccar/protocol/Tk103ProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/Tk103ProtocolEncoderTest.java index 34b2acf86..d1dad8c92 100644 --- a/src/test/java/org/traccar/protocol/Tk103ProtocolEncoderTest.java +++ b/src/test/java/org/traccar/protocol/Tk103ProtocolEncoderTest.java @@ -11,7 +11,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest { @Test public void testEncodeOutputControl() { - Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(); + Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null); Command command = new Command(); command.setDeviceId(1); @@ -25,8 +25,8 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest { @Test public void testEncodeEngineStop() throws Exception { - Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(); - + Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null); + Command command = new Command(); command.setDeviceId(1); command.setType(Command.TYPE_ENGINE_STOP); @@ -38,8 +38,8 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest { @Test public void testEncodePositionSingle() throws Exception { - Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(); - + Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null); + Command command = new Command(); command.setDeviceId(1); command.setType(Command.TYPE_POSITION_SINGLE); @@ -51,8 +51,8 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest { @Test public void testEncodePositionPeriodic() throws Exception { - Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(); - + Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null); + Command command = new Command(); command.setDeviceId(1); command.setType(Command.TYPE_POSITION_PERIODIC); @@ -65,8 +65,8 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest { @Test public void testEncodePositionStop() throws Exception { - Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(); - + Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null); + Command command = new Command(); command.setDeviceId(1); command.setType(Command.TYPE_POSITION_STOP); @@ -78,8 +78,8 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest { @Test public void testEncodeGetVersion() throws Exception { - Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(); - + Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null); + Command command = new Command(); command.setDeviceId(1); command.setType(Command.TYPE_GET_VERSION); @@ -91,8 +91,8 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest { @Test public void testEncodeRebootDevice() throws Exception { - Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(); - + Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null); + Command command = new Command(); command.setDeviceId(1); command.setType(Command.TYPE_REBOOT_DEVICE); @@ -104,8 +104,8 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest { @Test public void testEncodeSetOdometer() throws Exception { - Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(); - + Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null); + Command command = new Command(); command.setDeviceId(1); command.setType(Command.TYPE_SET_ODOMETER); @@ -117,7 +117,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest { @Test public void testEncodePositionSingleAlternative() throws Exception { - Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(true); + Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null, true); Command command = new Command(); command.setDeviceId(1); @@ -130,7 +130,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest { @Test public void testEncodePositionPeriodicAlternative() throws Exception { - Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(true); + Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null, true); Command command = new Command(); command.setDeviceId(1); @@ -143,7 +143,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest { @Test public void testEncodePositionStopAlternative() throws Exception { - Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(true); + Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null, true); Command command = new Command(); command.setDeviceId(1); @@ -156,7 +156,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest { @Test public void testEncodeGetVersionAlternative() throws Exception { - Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(true); + Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null, true); Command command = new Command(); command.setDeviceId(1); @@ -169,7 +169,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest { @Test public void testEncodeRebootDeviceAlternative() throws Exception { - Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(true); + Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null, true); Command command = new Command(); command.setDeviceId(1); @@ -182,7 +182,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest { @Test public void testEncodeIdentificationAlternative() throws Exception { - Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(true); + Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null, true); Command command = new Command(); command.setDeviceId(1); @@ -195,7 +195,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest { @Test public void testEncodeSosOnAlternative() throws Exception { - Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(true); + Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null, true); Command command = new Command(); command.setDeviceId(1); @@ -209,7 +209,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest { @Test public void testEncodeSosOffAlternative() throws Exception { - Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(true); + Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null, true); Command command = new Command(); command.setDeviceId(1); @@ -223,7 +223,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest { @Test public void testEncodeCustom() throws Exception { - Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(); + Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null); Command command = new Command(); command.setDeviceId(1); @@ -237,7 +237,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest { @Test public void testEncodeCustomAlternative() throws Exception { - Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(true); + Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null, true); Command command = new Command(); command.setDeviceId(1); @@ -251,7 +251,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest { @Test public void testEncodeSetConnectionAlternative() throws Exception { - Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(true); + Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null, true); Command command = new Command(); command.setDeviceId(1); @@ -266,7 +266,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest { @Test public void testEncodeSosNumberAlternative() throws Exception { - Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(true); + Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null, true); Command command = new Command(); command.setDeviceId(1); diff --git a/src/test/java/org/traccar/protocol/TotemProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/TotemProtocolEncoderTest.java index 5a47f74cc..d8c54afbe 100644 --- a/src/test/java/org/traccar/protocol/TotemProtocolEncoderTest.java +++ b/src/test/java/org/traccar/protocol/TotemProtocolEncoderTest.java @@ -11,13 +11,13 @@ public class TotemProtocolEncoderTest extends ProtocolTest { @Test public void testEncode() throws Exception { - TotemProtocolEncoder encoder = new TotemProtocolEncoder(); - + TotemProtocolEncoder encoder = new TotemProtocolEncoder(null); + Command command = new Command(); command.setDeviceId(2); command.setType(Command.TYPE_ENGINE_STOP); command.set(Command.KEY_DEVICE_PASSWORD, "000000"); - + assertEquals("*000000,025,C,1#", encoder.encodeCommand(command)); } diff --git a/src/test/java/org/traccar/protocol/WatchProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/WatchProtocolEncoderTest.java index a0631be3b..798213c7b 100644 --- a/src/test/java/org/traccar/protocol/WatchProtocolEncoderTest.java +++ b/src/test/java/org/traccar/protocol/WatchProtocolEncoderTest.java @@ -9,8 +9,8 @@ public class WatchProtocolEncoderTest extends ProtocolTest { @Test public void testEncode() throws Exception { - WatchProtocolEncoder encoder = new WatchProtocolEncoder(); - + WatchProtocolEncoder encoder = new WatchProtocolEncoder(null); + Command command; command = new Command(); @@ -60,7 +60,7 @@ public class WatchProtocolEncoderTest extends ProtocolTest { @Test public void testEncodeTimezone() { - WatchProtocolEncoder encoder = new WatchProtocolEncoder(); + WatchProtocolEncoder encoder = new WatchProtocolEncoder(null); Command command = new Command(); command.setDeviceId(1); diff --git a/src/test/java/org/traccar/protocol/WondexProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/WondexProtocolEncoderTest.java index 8209fc412..41fee2723 100644 --- a/src/test/java/org/traccar/protocol/WondexProtocolEncoderTest.java +++ b/src/test/java/org/traccar/protocol/WondexProtocolEncoderTest.java @@ -10,7 +10,7 @@ public class WondexProtocolEncoderTest extends ProtocolTest { @Test public void testEncode() throws Exception { - WondexProtocolEncoder encoder = new WondexProtocolEncoder(); + WondexProtocolEncoder encoder = new WondexProtocolEncoder(null); Command command = new Command(); command.setDeviceId(2); diff --git a/src/test/java/org/traccar/protocol/XirgoProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/XirgoProtocolEncoderTest.java index dd2e939c9..0ff47cad3 100644 --- a/src/test/java/org/traccar/protocol/XirgoProtocolEncoderTest.java +++ b/src/test/java/org/traccar/protocol/XirgoProtocolEncoderTest.java @@ -11,14 +11,14 @@ public class XirgoProtocolEncoderTest extends ProtocolTest { @Test public void testEncode() throws Exception { - XirgoProtocolEncoder encoder = new XirgoProtocolEncoder(); - + XirgoProtocolEncoder encoder = new XirgoProtocolEncoder(null); + Command command = new Command(); command.setDeviceId(1); command.setType(Command.TYPE_OUTPUT_CONTROL); command.set(Command.KEY_INDEX, 0); command.set(Command.KEY_DATA, 1); - + assertEquals("+XT:7005,2,1", encoder.encodeCommand(command)); } diff --git a/src/test/java/org/traccar/protocol/Xrb28ProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/Xrb28ProtocolEncoderTest.java index 49476d694..27efbd6db 100644 --- a/src/test/java/org/traccar/protocol/Xrb28ProtocolEncoderTest.java +++ b/src/test/java/org/traccar/protocol/Xrb28ProtocolEncoderTest.java @@ -11,13 +11,13 @@ public class Xrb28ProtocolEncoderTest extends ProtocolTest { @Test public void testEncodePositionPeriodic() { - Xrb28ProtocolEncoder encoder = new Xrb28ProtocolEncoder(); - + Xrb28ProtocolEncoder encoder = new Xrb28ProtocolEncoder(null); + Command command = new Command(); command.setDeviceId(1); command.setType(Command.TYPE_POSITION_PERIODIC); command.set(Command.KEY_FREQUENCY, 300); - + assertEquals("\u00ff\u00ff*SCOS,OM,123456789012345,D1,300#\n", encoder.encodeCommand(null, command)); } @@ -25,7 +25,7 @@ public class Xrb28ProtocolEncoderTest extends ProtocolTest { @Test public void testEncodeCustom() { - Xrb28ProtocolEncoder encoder = new Xrb28ProtocolEncoder(); + Xrb28ProtocolEncoder encoder = new Xrb28ProtocolEncoder(null); Command command = new Command(); command.setDeviceId(1); |