aboutsummaryrefslogtreecommitdiff
path: root/test/org/traccar
diff options
context:
space:
mode:
Diffstat (limited to 'test/org/traccar')
-rw-r--r--test/org/traccar/FilterHandlerTest.java26
-rw-r--r--test/org/traccar/helper/DecoderVerifier.java6
2 files changed, 27 insertions, 5 deletions
diff --git a/test/org/traccar/FilterHandlerTest.java b/test/org/traccar/FilterHandlerTest.java
index 1dacab692..33ffb3783 100644
--- a/test/org/traccar/FilterHandlerTest.java
+++ b/test/org/traccar/FilterHandlerTest.java
@@ -31,16 +31,38 @@ public class FilterHandlerTest {
filtingHandler = null;
passingHandler = null;
}
+
+ private Position createPosition(
+ long deviceId,
+ Date time,
+ boolean valid,
+ double latitude,
+ double longitude,
+ double altitude,
+ double speed,
+ double course) {
+
+ Position p = new Position();
+ p.setDeviceId(deviceId);
+ p.setTime(time);
+ p.setValid(valid);
+ p.setLatitude(latitude);
+ p.setLongitude(longitude);
+ p.setAltitude(altitude);
+ p.setSpeed(speed);
+ p.setCourse(course);
+ return p;
+ }
@Test
public void testFilterInvalid() throws Exception {
- Position position = new Position(0, new Date(), true, 10, 10, 10, 10, 10);
+ Position position = createPosition(0, new Date(), true, 10, 10, 10, 10, 10);
assertNotNull(filtingHandler.decode(null, null, position));
assertNotNull(passingHandler.decode(null, null, position));
- position = new Position(0, new Date(), false, 10, 10, 10, 10, 10);
+ position = createPosition(0, new Date(), false, 10, 10, 10, 10, 10);
assertNull(filtingHandler.decode(null, null, position));
assertNotNull(passingHandler.decode(null, null, position));
diff --git a/test/org/traccar/helper/DecoderVerifier.java b/test/org/traccar/helper/DecoderVerifier.java
index d73d9d58f..f815861f5 100644
--- a/test/org/traccar/helper/DecoderVerifier.java
+++ b/test/org/traccar/helper/DecoderVerifier.java
@@ -11,9 +11,9 @@ public class DecoderVerifier {
assertNotNull(position.getDeviceId());
- assertNotNull(position.getTime());
- assertTrue(position.getTime().after(new Date(946684800000L))); // 2000 year
- assertTrue(position.getTime().getTime() < new Date().getTime() + 3600000); // 1 hour from now
+ assertNotNull(position.getFixTime());
+ assertTrue(position.getFixTime().after(new Date(946684800000L))); // 2000 year
+ assertTrue(position.getFixTime().getTime() < new Date().getTime() + 3600000); // 1 hour from now
assertNotNull(position.getValid());