aboutsummaryrefslogtreecommitdiff
path: root/test/org/traccar/geofence/GeofenceCircleTest.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-06-18 11:56:59 +1200
committerGitHub <noreply@github.com>2016-06-18 11:56:59 +1200
commitb3b0cd9d6f2d26cef2e64ef38e23203f1f3fa51a (patch)
tree2e8deb61d372095aebb8270f740501c8124ea8c4 /test/org/traccar/geofence/GeofenceCircleTest.java
parentd801cba474cd05bb088348f04e8557ca638cd74f (diff)
parent82a78ff77a076231a8429f0dd84678d61c31d44a (diff)
downloadtrackermap-server-b3b0cd9d6f2d26cef2e64ef38e23203f1f3fa51a.tar.gz
trackermap-server-b3b0cd9d6f2d26cef2e64ef38e23203f1f3fa51a.tar.bz2
trackermap-server-b3b0cd9d6f2d26cef2e64ef38e23203f1f3fa51a.zip
Merge pull request #2012 from Abyss777/master
Implement Geofences on server side
Diffstat (limited to 'test/org/traccar/geofence/GeofenceCircleTest.java')
-rw-r--r--test/org/traccar/geofence/GeofenceCircleTest.java36
1 files changed, 36 insertions, 0 deletions
diff --git a/test/org/traccar/geofence/GeofenceCircleTest.java b/test/org/traccar/geofence/GeofenceCircleTest.java
new file mode 100644
index 000000000..52c214b53
--- /dev/null
+++ b/test/org/traccar/geofence/GeofenceCircleTest.java
@@ -0,0 +1,36 @@
+package org.traccar.geofence;
+
+import java.text.ParseException;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class GeofenceCircleTest {
+
+ @Test
+ public void testCircleWKT() {
+ String test = "CIRCLE (55.75414 37.6204, 100)";
+ GeofenceGeometry geofenceGeometry = new GeofenceCircle();
+ try {
+ geofenceGeometry.fromWkt(test);
+ } catch (ParseException e){
+ Assert.assertTrue("ParseExceprion: " + e.getMessage(), true);
+ }
+ Assert.assertEquals(geofenceGeometry.toWkt(), test);
+ }
+
+ @Test
+ public void testContainsCircle() {
+ String test = "CIRCLE (55.75414 37.6204, 100)";
+ GeofenceGeometry geofenceGeometry = new GeofenceCircle();
+ try {
+ geofenceGeometry.fromWkt(test);
+ } catch (ParseException e){
+ Assert.assertTrue("ParseExceprion: " + e.getMessage(), true);
+ }
+
+ Assert.assertTrue(geofenceGeometry.containsPoint(55.75477, 37.62025));
+
+ Assert.assertTrue(!geofenceGeometry.containsPoint(55.75545, 37.61921));
+ }
+}