package org.traccar.protocol;

import org.junit.Test;
import org.traccar.ProtocolTest;

public class OwnTracksProtocolDecoderTest extends ProtocolTest {

    @Test
    public void testDecode() throws Exception {

        OwnTracksProtocolDecoder decoder = new OwnTracksProtocolDecoder(new OwnTracksProtocol());

/*
 * I don'w know how to get JSON into that ...
 *
        verifyNull(decoder, request(
                "{ \"id\" : \"hello\" }"));

        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\"}"));

*/

    }

}

@@ -24,16 +24,70 @@
 tocol;%0A%0A
+import org.jboss.netty.handler.codec.http.HttpMethod;%0A
 import o
@@ -363,150 +363,193 @@
 );%0A%0A
-/*%0A * I don'w know how to get JSON into that ...%0A *%0A        verifyNull(decoder, request(%0A                %22%7B %5C%22id%5C%22 : %5C%22hello%5C%22 
+%09verifyPosition(decoder, request(HttpMethod.POST, %22/%22,%0A%09                buffer(text(%22%7B%5C%22lon%5C%22:2.29513,%5C%22lat%5C%22:48.85833,%5C%22tst%5C%22:1497349316,%5C%22_type%5C%22:%5C%22location%5C%22,%5C%22tid%5C%22:%5C%22JJ%5C%22
 %7D%22))
+)
+)
 ;%0A%0A
-        
+%09
 veri
@@ -576,17 +576,39 @@
 request(
-%0A
+HttpMethod.POST, %22/%22,%0A%09
         
@@ -615,16 +615,28 @@
         
+buffer(text(
 %22%7B%5C%22cog%5C
@@ -778,17 +778,39 @@
 JJ%5C%22
-%7D%22));%0A%0A*/
+,%5C%22t%5C%22:%5C%22u%5C%22,%5C%22batt%5C%22:67%7D%22))));
 %0A%0A  

add unit tests