From 96f37bd4206ad2f2034c026881230ca40436253d Mon Sep 17 00:00:00 2001 From: Jan-Piet Mens Date: Tue, 13 Jun 2017 22:13:03 +0200 Subject: add unit tests --- .../org/traccar/protocol/OwnTracksProtocolDecoderTest.java | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'test/org/traccar/protocol') diff --git a/test/org/traccar/protocol/OwnTracksProtocolDecoderTest.java b/test/org/traccar/protocol/OwnTracksProtocolDecoderTest.java index c11670cae..30ae95d03 100644 --- a/test/org/traccar/protocol/OwnTracksProtocolDecoderTest.java +++ b/test/org/traccar/protocol/OwnTracksProtocolDecoderTest.java @@ -1,5 +1,6 @@ package org.traccar.protocol; +import org.jboss.netty.handler.codec.http.HttpMethod; import org.junit.Test; import org.traccar.ProtocolTest; @@ -10,16 +11,11 @@ public class OwnTracksProtocolDecoderTest extends ProtocolTest { OwnTracksProtocolDecoder decoder = new OwnTracksProtocolDecoder(new OwnTracksProtocol()); -/* - * I don'w know how to get JSON into that ... - * - verifyNull(decoder, request( - "{ \"id\" : \"hello\" }")); + verifyPosition(decoder, request(HttpMethod.POST, "/", + buffer(text("{\"lon\":2.29513,\"lat\":48.85833,\"tst\":1497349316,\"_type\":\"location\",\"tid\":\"JJ\"}")))); - verifyPosition(decoder, request( - "{\"cog\":271,\"lon\":2.29513,\"acc\":5,\"vel\":61,\"vac\":21,\"lat\":48.85833,\"tst\":1497349316,\"alt\":167,\"_type\":\"location\",\"tid\":\"JJ\"}")); - -*/ + verifyPosition(decoder, request(HttpMethod.POST, "/", + buffer(text("{\"cog\":271,\"lon\":2.29513,\"acc\":5,\"vel\":61,\"vac\":21,\"lat\":48.85833,\"tst\":1497349316,\"alt\":167,\"_type\":\"location\",\"tid\":\"JJ\",\"t\":\"u\",\"batt\":67}")))); } -- cgit v1.2.3