aboutsummaryrefslogtreecommitdiff
path: root/test/org/traccar/geofence/GeofenceCircleTest.java
blob: 133ca1db88db2a5a338a33ef7888b1a6762dab3b (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
package org.traccar.geofence;

import java.text.ParseException;

import org.junit.Assert;
import org.junit.Test;

public class GeofenceCircleTest {

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

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