diff options
Diffstat (limited to 'test/org')
-rw-r--r-- | test/org/traccar/geocode/ReverseGeocoderTest.java | 47 |
1 files changed, 34 insertions, 13 deletions
diff --git a/test/org/traccar/geocode/ReverseGeocoderTest.java b/test/org/traccar/geocode/ReverseGeocoderTest.java index 31cff8f71..2336418d8 100644 --- a/test/org/traccar/geocode/ReverseGeocoderTest.java +++ b/test/org/traccar/geocode/ReverseGeocoderTest.java @@ -1,35 +1,56 @@ package org.traccar.geocode; +import org.junit.Assert; +import org.junit.Test; + public class ReverseGeocoderTest { - /*@Test + private boolean enable = false; + + @Test + public void test() { + if (enable) { + testGoogle(); + testNominatim(); + testGisgraphy(); + } + + } + public void testGoogle() { ReverseGeocoder reverseGeocoder = new GoogleReverseGeocoder(); - assertEquals( - "1600 Amphitheatre Pkwy, Mountain View, CA, US", - reverseGeocoder.getAddress(new AddressFormat(), 37.4217550, -122.0846330)); + reverseGeocoder.getAddress(new AddressFormat(), 37.4217550, -122.0846330, new ReverseGeocoder.ReverseGeocoderCallback() { + @Override + public void onResult(String address) { + Assert.assertEquals("1600 Amphitheatre Pkwy, Mountain View, CA, US", address); + } + }); } - @Test public void testNominatim() { ReverseGeocoder reverseGeocoder = new NominatimReverseGeocoder(); - assertEquals( - "35 West 9th Street, NYC, New York, US", - reverseGeocoder.getAddress(new AddressFormat(), 40.7337807, -73.9974401)); + reverseGeocoder.getAddress(new AddressFormat(), 40.7337807, -73.9974401, new ReverseGeocoder.ReverseGeocoderCallback() { + @Override + public void onResult(String address) { + Assert.assertEquals("35 West 9th Street, NYC, New York, US", address); + } + }); } - @Test public void testGisgraphy() { ReverseGeocoder reverseGeocoder = new GisgraphyReverseGeocoder(); - assertEquals( - "Rue du Jardinet, Paris, FR", - reverseGeocoder.getAddress(new AddressFormat(), 48.8530000, 2.3400000)); - }*/ + reverseGeocoder.getAddress(new AddressFormat(), 48.8530000, 2.3400000, new ReverseGeocoder.ReverseGeocoderCallback() { + @Override + public void onResult(String address) { + Assert.assertEquals("Rue du Jardinet, Paris, FR", address); + } + }); + } } |