From d13f618ee3b8463d063b7f67e039299560245597 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sat, 31 Dec 2016 11:17:50 +1300 Subject: Implement geocoding error handling --- test/org/traccar/geocode/ReverseGeocoderTest.java | 30 +++++++++++++++++++---- 1 file changed, 25 insertions(+), 5 deletions(-) (limited to 'test/org/traccar') diff --git a/test/org/traccar/geocode/ReverseGeocoderTest.java b/test/org/traccar/geocode/ReverseGeocoderTest.java index 2b0c30779..eab147cd5 100644 --- a/test/org/traccar/geocode/ReverseGeocoderTest.java +++ b/test/org/traccar/geocode/ReverseGeocoderTest.java @@ -35,9 +35,13 @@ public class ReverseGeocoderTest { reverseGeocoder.getAddress(new AddressFormat(), 37.4217550, -122.0846330, new ReverseGeocoder.ReverseGeocoderCallback() { @Override - public void onResult(String address) { + public void onSuccess(String address) { setAddress(address); } + + @Override + public void onFailure(Throwable e) { + } }); Assert.assertEquals("1600 Amphitheatre Pkwy, Mountain View, CA, US", waitAddress()); } @@ -47,9 +51,13 @@ public class ReverseGeocoderTest { reverseGeocoder.getAddress(new AddressFormat(), 40.7337807, -73.9974401, new ReverseGeocoder.ReverseGeocoderCallback() { @Override - public void onResult(String address) { + public void onSuccess(String address) { setAddress(address); } + + @Override + public void onFailure(Throwable e) { + } }); Assert.assertEquals("35 West 9th Street, NYC, New York, US", waitAddress()); } @@ -59,9 +67,13 @@ public class ReverseGeocoderTest { reverseGeocoder.getAddress(new AddressFormat(), 48.8530000, 2.3400000, new ReverseGeocoder.ReverseGeocoderCallback() { @Override - public void onResult(String address) { + public void onSuccess(String address) { setAddress(address); } + + @Override + public void onFailure(Throwable e) { + } }); Assert.assertEquals("Rue du Jardinet, Paris, FR", waitAddress()); } @@ -72,9 +84,13 @@ public class ReverseGeocoderTest { reverseGeocoder.getAddress(new AddressFormat(), 34.116302, -118.051519, new ReverseGeocoder.ReverseGeocoderCallback() { @Override - public void onResult(String address) { + public void onSuccess(String address) { setAddress(address); } + + @Override + public void onFailure(Throwable e) { + } }); Assert.assertEquals("Charleston Road, California, US", waitAddress()); } @@ -84,9 +100,13 @@ public class ReverseGeocoderTest { reverseGeocoder.getAddress(new AddressFormat(), 34.116302, -118.051519, new ReverseGeocoder.ReverseGeocoderCallback() { @Override - public void onResult(String address) { + public void onSuccess(String address) { setAddress(address); } + + @Override + public void onFailure(Throwable e) { + } }); Assert.assertEquals("Estrella Avenue, Arcadia, California, United States", waitAddress()); } -- cgit v1.2.3