aboutsummaryrefslogtreecommitdiff
path: root/test/org/traccar
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2016-05-26 09:30:43 +0500
committerAbyss777 <abyss@fox5.ru>2016-05-26 09:30:43 +0500
commitaa12e5c750e771016545269ffa39409b06b47eee (patch)
treed21b4414b532bfc53c9a905f3caa09f70b43b59e /test/org/traccar
parentac2405f0d57fac51fe95aa755f90fe82f26f73bc (diff)
downloadtraccar-server-aa12e5c750e771016545269ffa39409b06b47eee.tar.gz
traccar-server-aa12e5c750e771016545269ffa39409b06b47eee.tar.bz2
traccar-server-aa12e5c750e771016545269ffa39409b06b47eee.zip
- Simplification of the hierarchy of models classes
- Removed automatically founded unnecessary imports
Diffstat (limited to 'test/org/traccar')
-rw-r--r--test/org/traccar/DistanceHandlerTest.java3
-rw-r--r--test/org/traccar/ProtocolTest.java18
-rw-r--r--test/org/traccar/location/LocationProviderTest.java15
3 files changed, 14 insertions, 22 deletions
diff --git a/test/org/traccar/DistanceHandlerTest.java b/test/org/traccar/DistanceHandlerTest.java
index e58d9c772..853f2c645 100644
--- a/test/org/traccar/DistanceHandlerTest.java
+++ b/test/org/traccar/DistanceHandlerTest.java
@@ -1,7 +1,6 @@
package org.traccar;
import org.junit.Test;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import static org.junit.Assert.assertEquals;
@@ -15,7 +14,7 @@ public class DistanceHandlerTest {
Position position = distanceHandler.calculateDistance(new Position());
- assertEquals(0.0, position.getAttributes().get(Event.KEY_DISTANCE));
+ assertEquals(0.0, position.getAttributes().get(Position.KEY_DISTANCE));
}
diff --git a/test/org/traccar/ProtocolTest.java b/test/org/traccar/ProtocolTest.java
index a8f3d13cf..503bc4c00 100644
--- a/test/org/traccar/ProtocolTest.java
+++ b/test/org/traccar/ProtocolTest.java
@@ -9,12 +9,10 @@ import org.junit.Assert;
import org.traccar.database.IdentityManager;
import org.traccar.model.Command;
import org.traccar.model.Device;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import javax.xml.bind.DatatypeConverter;
import java.nio.ByteOrder;
-import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.text.DateFormat;
import java.text.ParseException;
@@ -198,16 +196,16 @@ public class ProtocolTest {
Assert.assertFalse("no attributes", attributes.isEmpty());
}
- if (attributes.containsKey(Event.KEY_LAC) || attributes.containsKey(Event.KEY_CID)) {
- checkInteger(attributes.get(Event.KEY_LAC), 1, 65535);
- checkInteger(attributes.get(Event.KEY_CID), 0, 268435455);
+ if (attributes.containsKey(Position.KEY_LAC) || attributes.containsKey(Position.KEY_CID)) {
+ checkInteger(attributes.get(Position.KEY_LAC), 1, 65535);
+ checkInteger(attributes.get(Position.KEY_CID), 0, 268435455);
}
- if (attributes.containsKey(Event.KEY_MCC) || attributes.containsKey(Event.KEY_MNC)) {
- checkInteger(attributes.get(Event.KEY_MCC), 100, 999);
- checkInteger(attributes.get(Event.KEY_MNC), 0, 999);
- Assert.assertTrue("value missing", attributes.containsKey(Event.KEY_LAC));
- Assert.assertTrue("value missing", attributes.containsKey(Event.KEY_CID));
+ if (attributes.containsKey(Position.KEY_MCC) || attributes.containsKey(Position.KEY_MNC)) {
+ checkInteger(attributes.get(Position.KEY_MCC), 100, 999);
+ checkInteger(attributes.get(Position.KEY_MNC), 0, 999);
+ Assert.assertTrue("value missing", attributes.containsKey(Position.KEY_LAC));
+ Assert.assertTrue("value missing", attributes.containsKey(Position.KEY_CID));
}
}
diff --git a/test/org/traccar/location/LocationProviderTest.java b/test/org/traccar/location/LocationProviderTest.java
index b7280cfea..910f9e9ea 100644
--- a/test/org/traccar/location/LocationProviderTest.java
+++ b/test/org/traccar/location/LocationProviderTest.java
@@ -2,12 +2,7 @@ package org.traccar.location;
import org.junit.Assert;
import org.junit.Test;
-import org.traccar.geocode.AddressFormat;
-import org.traccar.geocode.GisgraphyReverseGeocoder;
-import org.traccar.geocode.GoogleReverseGeocoder;
-import org.traccar.geocode.NominatimReverseGeocoder;
-import org.traccar.geocode.ReverseGeocoder;
-import org.traccar.model.Event;
+import org.traccar.model.Position;
import java.util.HashMap;
import java.util.Map;
@@ -27,10 +22,10 @@ public class LocationProviderTest {
OpenCellIdLocationProvider locationProvider = new OpenCellIdLocationProvider("fake");
Map<String, Object> attributes = new HashMap<>();
- attributes.put(Event.KEY_MCC, 260);
- attributes.put(Event.KEY_MNC, 2);
- attributes.put(Event.KEY_LAC, 10250);
- attributes.put(Event.KEY_CID, 26511);
+ attributes.put(Position.KEY_MCC, 260);
+ attributes.put(Position.KEY_MNC, 2);
+ attributes.put(Position.KEY_LAC, 10250);
+ attributes.put(Position.KEY_CID, 26511);
locationProvider.getLocation(attributes, new LocationProvider.LocationProviderCallback() {
@Override