aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/org/traccar/geofence/GeofenceCircleTest.java
blob: 9a02cec7644f835eaa0eb51ff741965596843e23 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package org.traccar.geofence;

import org.junit.Test;

import java.text.ParseException;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

public class GeofenceCircleTest {

    @Test
    public void testCircleWkt() throws ParseException {
        String test = "CIRCLE (55.75414 37.6204, 100)";
        GeofenceGeometry geofenceGeometry = new GeofenceCircle(test);
        assertEquals(geofenceGeometry.toWkt(), test);
    }

    @Test
    public void testContainsCircle() throws ParseException {
        GeofenceGeometry geofenceGeometry = new GeofenceCircle("CIRCLE (55.75414 37.6204, 100)");
        assertTrue(geofenceGeometry.containsPoint(null, null, 55.75477, 37.62025));
        assertFalse(geofenceGeometry.containsPoint(null, null, 55.75545, 37.61921));
    }

}