From a51ccd03c339f0b1330d726ebcce73573808b9dc Mon Sep 17 00:00:00 2001 From: Bananeweizen Date: Sun, 14 Dec 2014 14:46:04 +0100 Subject: fix geocoder test The suppressed Android test didn't fit into the offset range, therefore increasing the offset and always enabling the test. --- .../src/cgeo/geocaching/location/GeocoderTest.java | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'tests/src/cgeo/geocaching') diff --git a/tests/src/cgeo/geocaching/location/GeocoderTest.java b/tests/src/cgeo/geocaching/location/GeocoderTest.java index cce093a..f53c074 100644 --- a/tests/src/cgeo/geocaching/location/GeocoderTest.java +++ b/tests/src/cgeo/geocaching/location/GeocoderTest.java @@ -10,26 +10,31 @@ import org.assertj.core.data.Offset; import rx.Observable; +import android.annotation.TargetApi; import android.location.Address; -import android.test.suitebuilder.annotation.Suppress; +import android.location.Geocoder; +import android.os.Build; public class GeocoderTest extends CGeoTestCase { private static final String TEST_ADDRESS = "46 rue Barrault, Paris, France"; private static final double TEST_LATITUDE = 48.82677; private static final double TEST_LONGITUDE = 2.34644; - private static final Offset TEST_OFFSET = Offset.offset(0.00010); - - @Suppress // Some emulators don't have access to Google Android geocoder - public void testAndroidGeocoder() { - testGeocoder(new AndroidGeocoder(CgeoApplication.getInstance()).getFromLocationName(TEST_ADDRESS), "Android"); + private static final Offset TEST_OFFSET = Offset.offset(0.00050); + + @TargetApi(Build.VERSION_CODES.GINGERBREAD) + public static void testAndroidGeocoder() { + // Some emulators don't have access to Google Android geocoder + if (Geocoder.isPresent()) { + testGeocoder(new AndroidGeocoder(CgeoApplication.getInstance()).getFromLocationName(TEST_ADDRESS), "Android"); + } } - public void testGCGeocoder() { + public static void testGCGeocoder() { testGeocoder(GCGeocoder.getFromLocationName(TEST_ADDRESS), "GC"); } - public void testMapQuestGeocoder() { + public static void testMapQuestGeocoder() { testGeocoder(MapQuestGeocoder.getFromLocationName(TEST_ADDRESS), "MapQuest"); } -- cgit v1.1