aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/org/traccar/speedlimit/OverpassSpeedLimitProviderTest.java
blob: aa0be23cf2aea8ba570ba68adcf6a9f49ac5380e (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
28
29
30
31
32
33
34
35
36
37
38
39
40
package org.traccar.speedlimit;

import org.junit.Ignore;
import org.junit.Test;

import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;

public class OverpassSpeedLimitProviderTest {

    private final Client client = ClientBuilder.newClient();

    @Ignore
    @Test
    public void test() throws Exception {
        testOverpass();
    }

    public void testOverpass() throws Exception {
        SpeedLimitProvider provider = new OverpassSpeedLimitProvider(client, "http://8.8.8.8/api/interpreter");

        provider.getSpeedLimit(34.74767, -82.48098, new SpeedLimitProvider.SpeedLimitProviderCallback() {
            @Override
            public void onSuccess(double speedLimit) {
                assertEquals(52.1, speedLimit, 0.1);
            }

            @Override
            public void onFailure(Throwable e) {
                fail();
            }
        });

        Thread.sleep(Long.MAX_VALUE);
    }

}