diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-10-23 09:40:20 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-10-23 09:40:20 +1300 |
commit | b4d3a5de05422b88e518a173359d45ce13ea4b2b (patch) | |
tree | 827b7545b17645f1fa0598fbf19bef52ca9383eb /test/org/traccar/ProtocolDecoderTest.java | |
parent | c585535761dba635dca000f900cc33d4cc5e4631 (diff) | |
download | trackermap-server-b4d3a5de05422b88e518a173359d45ce13ea4b2b.tar.gz trackermap-server-b4d3a5de05422b88e518a173359d45ce13ea4b2b.tar.bz2 trackermap-server-b4d3a5de05422b88e518a173359d45ce13ea4b2b.zip |
Fix date builder and unit testing
Diffstat (limited to 'test/org/traccar/ProtocolDecoderTest.java')
-rw-r--r-- | test/org/traccar/ProtocolDecoderTest.java | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/test/org/traccar/ProtocolDecoderTest.java b/test/org/traccar/ProtocolDecoderTest.java index f58de880a..03e8314d6 100644 --- a/test/org/traccar/ProtocolDecoderTest.java +++ b/test/org/traccar/ProtocolDecoderTest.java @@ -79,7 +79,8 @@ public class ProtocolDecoderTest { Position position = new Position(); if (time != null) { - DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); + dateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); position.setTime(dateFormat.parse(time)); } position.setValid(valid); @@ -136,10 +137,7 @@ public class ProtocolDecoderTest { Position position = (Position) decodedObject; if (expected.getFixTime() != null) { - DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - dateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); - Assert.assertEquals("time", - dateFormat.format(expected.getFixTime()), dateFormat.format(position.getFixTime())); + Assert.assertEquals("time", expected.getFixTime(), position.getFixTime()); } Assert.assertEquals("valid", expected.getValid(), position.getValid()); Assert.assertEquals("latitude", expected.getLatitude(), position.getLatitude(), 0.00001); |