aboutsummaryrefslogtreecommitdiff
path: root/test/org/traccar/geocoder/GeocoderTest.java
blob: 42220cde1fdbd6a4401dbfd7b8b0dfc5571657ca (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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
package org.traccar.geocoder;

import java.util.Locale;

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

import static org.junit.Assert.assertEquals;

public class GeocoderTest {

    static {
        Locale.setDefault(Locale.US);
    }

    @Ignore
    @Test
    public void testGoogle() {
        Geocoder geocoder = new GoogleGeocoder(null, null, 0, new AddressFormat());
        String address = geocoder.getAddress(31.776797, 35.211489, null);
        assertEquals("1 Ibn Shaprut St, Jerusalem, Jerusalem District, IL", address);
    }

    @Ignore
    @Test
    public void testNominatim() {
        Geocoder geocoder = new NominatimGeocoder(null, null, null, 0, new AddressFormat());
        String address = geocoder.getAddress(40.7337807, -73.9974401, null);
        assertEquals("35 West 9th Street, NYC, New York, US", address);
    }

    @Ignore
    @Test
    public void testGisgraphy() {
        Geocoder geocoder = new GisgraphyGeocoder(new AddressFormat());
        String address = geocoder.getAddress(48.8530000, 2.3400000, null);
        assertEquals("Rue du Jardinet, Paris, Île-de-France, FR", address);
    }

    @Ignore
    @Test
    public void testOpenCage() {
        Geocoder geocoder = new OpenCageGeocoder(
                "http://api.opencagedata.com/geocode/v1", "SECRET", 0, new AddressFormat());
        String address = geocoder.getAddress(34.116302, -118.051519, null);
        assertEquals("Charleston Road, California, US", address);
    }

    @Ignore
    @Test
    public void testGeocodeFarm() {
        Geocoder geocoder = new GeocodeFarmGeocoder(null, null, 0, new AddressFormat());
        String address = geocoder.getAddress(34.116302, -118.051519, null);
        assertEquals("Estrella Avenue, Arcadia, California, United States", address);
    }

    @Ignore
    @Test
    public void testGeocodeXyz() {
        Geocoder geocoder = new GeocodeXyzGeocoder(null, 0, new AddressFormat());
        String address = geocoder.getAddress(34.116302, -118.051519, null);
        assertEquals("605 ESTRELLA AVE, ARCADIA, California United States of America, US", address);
    }

    @Ignore
    @Test
    public void testBan() {
        Geocoder geocoder = new BanGeocoder(0, new AddressFormat("%f [%d], %c"));
        String address = geocoder.getAddress(48.8575, 2.2944, null);
        assertEquals("8 Avenue Gustave Eiffel 75007 Paris [75, Paris, Île-de-France], FR", address);
    }

    @Ignore
    @Test
    public void testHere() {
        Geocoder geocoder = new HereGeocoder("", "", null, 0, new AddressFormat());
        String address = geocoder.getAddress(48.8575, 2.2944, null);
        assertEquals("6 Avenue Gustave Eiffel, Paris, Île-de-France, FRA", address);
    }

}