diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-10-08 23:10:00 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-10-08 23:10:00 +1300 |
commit | af49cbb232a46b1af07ed43551c5c07fc26bfe2f (patch) | |
tree | 46732f454b3825113135d8b99e1507d8f1005a04 | |
parent | c99e32bb5da8a19c19c13e871d5c7b843b2bd182 (diff) | |
download | traccar-server-af49cbb232a46b1af07ed43551c5c07fc26bfe2f.tar.gz traccar-server-af49cbb232a46b1af07ed43551c5c07fc26bfe2f.tar.bz2 traccar-server-af49cbb232a46b1af07ed43551c5c07fc26bfe2f.zip |
Add Ulbotech unit test case
-rw-r--r-- | src/org/traccar/geocode/JsonReverseGeocoder.java | 10 | ||||
-rw-r--r-- | test/org/traccar/protocol/UlbotechProtocolDecoderTest.java | 6 |
2 files changed, 9 insertions, 7 deletions
diff --git a/src/org/traccar/geocode/JsonReverseGeocoder.java b/src/org/traccar/geocode/JsonReverseGeocoder.java index 88150a299..6f4b5dcd2 100644 --- a/src/org/traccar/geocode/JsonReverseGeocoder.java +++ b/src/org/traccar/geocode/JsonReverseGeocoder.java @@ -17,15 +17,14 @@ package org.traccar.geocode; import com.ning.http.client.AsyncCompletionHandler; import com.ning.http.client.Response; -import org.traccar.Context; - -import javax.json.Json; -import javax.json.JsonObject; -import javax.json.JsonReader; import java.util.AbstractMap; import java.util.Collections; import java.util.LinkedHashMap; import java.util.Map; +import javax.json.Json; +import javax.json.JsonObject; +import javax.json.JsonReader; +import org.traccar.Context; public abstract class JsonReverseGeocoder implements ReverseGeocoder { @@ -37,6 +36,7 @@ public abstract class JsonReverseGeocoder implements ReverseGeocoder { this.url = url; if (cacheSize > 0) { this.cache = Collections.synchronizedMap(new LinkedHashMap<Map.Entry<Double, Double>, String>() { + @Override protected boolean removeEldestEntry(Map.Entry eldest) { return size() > cacheSize; } diff --git a/test/org/traccar/protocol/UlbotechProtocolDecoderTest.java b/test/org/traccar/protocol/UlbotechProtocolDecoderTest.java index fd2ad28fc..18c6c9622 100644 --- a/test/org/traccar/protocol/UlbotechProtocolDecoderTest.java +++ b/test/org/traccar/protocol/UlbotechProtocolDecoderTest.java @@ -1,10 +1,9 @@ package org.traccar.protocol; import org.jboss.netty.buffer.ChannelBuffers; +import static org.junit.Assert.assertNull; import org.junit.Test; import org.traccar.helper.ChannelBufferTools; - -import static org.junit.Assert.assertNull; import static org.traccar.helper.DecoderVerifier.verify; public class UlbotechProtocolDecoderTest extends ProtocolDecoderTest { @@ -15,6 +14,9 @@ public class UlbotechProtocolDecoderTest extends ProtocolDecoderTest { UlbotechProtocolDecoder decoder = new UlbotechProtocolDecoder(new UlbotechProtocol()); verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( + "f8010103596580419465449da8564e010efe55a1800923d04b0000000000710304000000000404000178d2050603571876220ec3caf8")))); + + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( "f8010103545500500179009ccb4b62010e00144db906310d3f0000000000cb0304000000000404000a8123050603211860221006080000000100000000ef97f8")))); verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( |