aboutsummaryrefslogtreecommitdiff
path: root/test/org/traccar/geofence/GeofenceCircleTest.java
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2016-06-10 16:02:06 +0500
committerAbyss777 <abyss@fox5.ru>2016-06-10 16:02:06 +0500
commit41fe4ca770875842f4d17531506c4bc74dc90501 (patch)
treed8cdfbf19873d8dd4ae100887b0cec5134f5eb74 /test/org/traccar/geofence/GeofenceCircleTest.java
parente966778c43ee4a2fa12705cded8648b96ef78f61 (diff)
downloadtrackermap-server-41fe4ca770875842f4d17531506c4bc74dc90501.tar.gz
trackermap-server-41fe4ca770875842f4d17531506c4bc74dc90501.tar.bz2
trackermap-server-41fe4ca770875842f4d17531506c4bc74dc90501.zip
Geofences
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..820f34e34
--- /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));
+ }
+}