diff options
author | Jan-Piet Mens <jpmens@gmail.com> | 2017-06-13 22:13:03 +0200 |
---|---|---|
committer | Jan-Piet Mens <jpmens@gmail.com> | 2017-06-14 07:57:40 +0200 |
commit | 96f37bd4206ad2f2034c026881230ca40436253d (patch) | |
tree | 4fc4cfb751e1adaeb3fdefe15b2dfbede9a9e216 /test/org/traccar/protocol | |
parent | 7f62f1671b38b9ffbeff66aa4ee79e0f875b1c66 (diff) | |
download | traccar-server-96f37bd4206ad2f2034c026881230ca40436253d.tar.gz traccar-server-96f37bd4206ad2f2034c026881230ca40436253d.tar.bz2 traccar-server-96f37bd4206ad2f2034c026881230ca40436253d.zip |
add unit tests
Diffstat (limited to 'test/org/traccar/protocol')
-rw-r--r-- | test/org/traccar/protocol/OwnTracksProtocolDecoderTest.java | 14 |
1 files changed, 5 insertions, 9 deletions
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}")))); } |