aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/org/traccar/protocol/PuiProtocolDecoderTest.java23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/test/java/org/traccar/protocol/PuiProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/PuiProtocolDecoderTest.java
new file mode 100644
index 000000000..41568d0c1
--- /dev/null
+++ b/src/test/java/org/traccar/protocol/PuiProtocolDecoderTest.java
@@ -0,0 +1,23 @@
+package org.traccar.protocol;
+
+import io.netty.handler.codec.mqtt.MqttMessageBuilders;
+import io.netty.handler.codec.mqtt.MqttQoS;
+import org.junit.jupiter.api.Test;
+import org.traccar.ProtocolTest;
+
+public class PuiProtocolDecoderTest extends ProtocolTest {
+
+ @Test
+ public void testDecode() throws Exception {
+
+ var decoder = inject(new PuiProtocolDecoder(null));
+
+ verifyNull(decoder, MqttMessageBuilders.connect().clientId(
+ "123456789012345").build());
+
+ verifyPosition(decoder, MqttMessageBuilders.publish().payload(buffer(
+ "{ \"id\": \"015262001044848\", \"ts\": \"20190109T021918.312Z\", \"rpt\": \"hf\", \"location\": { \"lat\": 33.91233, \"lon\": -84.20784 }, \"bear\": 70, \"spd\": 2482, \"ign\": \"on\" }")).qos(MqttQoS.EXACTLY_ONCE).messageId(1).build());
+
+ }
+
+}