aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/org/traccar/protocol/PuiProtocolDecoderTest.java
blob: 1bbf17361de93d3445cf9810102a41a52973bd1a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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\": \"2023-06-01T03:09:51.362Z\", \"rpt\": \"hf\", \"location\": { \"lat\": 33.91233, \"lon\": -84.20784 }, \"bear\": 70, \"spd\": 2482, \"ign\": \"on\" }")).qos(MqttQoS.EXACTLY_ONCE).messageId(1).build());

    }

}