diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-10-22 15:26:17 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-10-22 15:26:17 +1300 |
commit | 1ca95d099df96d576a0eaddc6e42b5b41aed3e06 (patch) | |
tree | 65ae84eb5e301317263fd72c31cc54922c71eb96 /test/org/traccar/helper | |
parent | 122a26d2822f35b27b9cb0b217916d6b821d9654 (diff) | |
download | traccar-server-1ca95d099df96d576a0eaddc6e42b5b41aed3e06.tar.gz traccar-server-1ca95d099df96d576a0eaddc6e42b5b41aed3e06.tar.bz2 traccar-server-1ca95d099df96d576a0eaddc6e42b5b41aed3e06.zip |
Refactor protocol unit testing
Diffstat (limited to 'test/org/traccar/helper')
-rw-r--r-- | test/org/traccar/helper/DecoderVerifier.java | 64 | ||||
-rw-r--r-- | test/org/traccar/helper/TestIdentityManager.java | 26 |
2 files changed, 0 insertions, 90 deletions
diff --git a/test/org/traccar/helper/DecoderVerifier.java b/test/org/traccar/helper/DecoderVerifier.java deleted file mode 100644 index 38f73aabc..000000000 --- a/test/org/traccar/helper/DecoderVerifier.java +++ /dev/null @@ -1,64 +0,0 @@ -package org.traccar.helper; - -import java.util.Date; -import java.util.List; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; -import org.traccar.model.Position; - -public class DecoderVerifier { - - private static void verifyPosition(Position position) { - - assertNotNull(position.getDeviceId()); - - assertNotNull(position.getFixTime()); - assertTrue(position.getFixTime().after(new Date(946684800000L))); // 2000 year - assertTrue(position.getFixTime().getTime() < System.currentTimeMillis() + 3600000); // 1 hour from now - - assertNotNull(position.getValid()); - - assertNotNull(position.getLatitude()); - assertTrue(position.getLatitude() >= -90); - assertTrue(position.getLatitude() <= 90); - - assertNotNull(position.getLongitude()); - assertTrue(position.getLongitude() >= -180); - assertTrue(position.getLongitude() <= 180); - - assertNotNull(position.getAltitude()); - assertTrue(position.getAltitude() >= -12262); - assertTrue(position.getAltitude() <= 18000); - - assertNotNull(position.getSpeed()); - assertTrue(position.getSpeed() >= 0); - assertTrue(position.getSpeed() <= 869); - - assertNotNull(position.getCourse()); - assertTrue(position.getCourse() >= 0); - assertTrue(position.getCourse() <= 360); - - assertNotNull(position.getAttributes()); - - } - - public static void verify(Object object) { - - assertNotNull(object); - - if (object instanceof Position) { - verifyPosition((Position) object); - } else if (object instanceof List) { - List<Position> positions = (List<Position>) object; - - assertFalse(positions.isEmpty()); - - for (Position position : positions) { - verifyPosition(position); - } - } - - } - -} diff --git a/test/org/traccar/helper/TestIdentityManager.java b/test/org/traccar/helper/TestIdentityManager.java deleted file mode 100644 index d279241e4..000000000 --- a/test/org/traccar/helper/TestIdentityManager.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.traccar.helper; - -import org.traccar.database.IdentityManager; -import org.traccar.model.Device; - -public class TestIdentityManager implements IdentityManager { - - private final Device device; - - public TestIdentityManager() { - device = new Device(); - device.setId(1); - device.setUniqueId("123456789012345"); - } - - @Override - public Device getDeviceById(long id) { - return device; - } - - @Override - public Device getDeviceByUniqueId(String imei) { - return device; - } - -} |