diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2019-04-27 09:41:52 -0700 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2019-04-27 09:41:52 -0700 |
commit | 4abbb070fa13c480f2bc23aff0cfd026d186af80 (patch) | |
tree | ab4f5ae8e6c63e60b4efbb8422a181fd7a2b5b26 /src/test/java/org/traccar/ProtocolTest.java | |
parent | 9209299d3e55f07c1585866224a8264aca2bf5a1 (diff) | |
download | trackermap-server-4abbb070fa13c480f2bc23aff0cfd026d186af80.tar.gz trackermap-server-4abbb070fa13c480f2bc23aff0cfd026d186af80.tar.bz2 trackermap-server-4abbb070fa13c480f2bc23aff0cfd026d186af80.zip |
Fix status decoding
Diffstat (limited to 'src/test/java/org/traccar/ProtocolTest.java')
-rw-r--r-- | src/test/java/org/traccar/ProtocolTest.java | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/test/java/org/traccar/ProtocolTest.java b/src/test/java/org/traccar/ProtocolTest.java index 4d48bb763..bfff4eef3 100644 --- a/src/test/java/org/traccar/ProtocolTest.java +++ b/src/test/java/org/traccar/ProtocolTest.java @@ -17,6 +17,7 @@ import java.nio.charset.StandardCharsets; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; +import java.util.Collection; import java.util.Date; import java.util.List; import java.util.Map; @@ -101,7 +102,13 @@ public class ProtocolTest extends BaseTest { } protected void verifyAttribute(BaseProtocolDecoder decoder, Object object, String key, Object expected) throws Exception { - Position position = (Position) decoder.decode(null, null, object); + Object decodedObject = decoder.decode(null, null, object); + Position position; + if (decodedObject instanceof Collection) { + position = (Position) ((Collection) decodedObject).iterator().next(); + } else { + position = (Position) decodedObject; + } switch (key) { case "speed": assertEquals(expected, position.getSpeed()); |