aboutsummaryrefslogtreecommitdiff
path: root/test/org
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-04-27 12:01:43 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2015-04-27 12:01:43 +1200
commitd560f0cfdbbe9639e681bfeedd25d4de845d6161 (patch)
tree3845758ede6bafb9ee8d5fc2bda37de446ae9f34 /test/org
parent8e24c10cdc42fdece70d420b206bb6062edb589c (diff)
downloadtrackermap-server-d560f0cfdbbe9639e681bfeedd25d4de845d6161.tar.gz
trackermap-server-d560f0cfdbbe9639e681bfeedd25d4de845d6161.tar.bz2
trackermap-server-d560f0cfdbbe9639e681bfeedd25d4de845d6161.zip
Refactor model classes
Diffstat (limited to 'test/org')
-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());