diff options
Diffstat (limited to 'tests/src/cgeo/geocaching/connector/gc/GCParserTest.java')
| -rw-r--r-- | tests/src/cgeo/geocaching/connector/gc/GCParserTest.java | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/tests/src/cgeo/geocaching/connector/gc/GCParserTest.java b/tests/src/cgeo/geocaching/connector/gc/GCParserTest.java index 43b6d01..e6fed94 100644 --- a/tests/src/cgeo/geocaching/connector/gc/GCParserTest.java +++ b/tests/src/cgeo/geocaching/connector/gc/GCParserTest.java @@ -21,7 +21,6 @@ import cgeo.test.Compare; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; -import android.os.Handler; import android.test.suitebuilder.annotation.MediumTest; import java.util.ArrayList; @@ -56,6 +55,8 @@ public class GCParserTest extends AbstractResourceInstrumentationTestCase { assertNotNull(result); assertEquals(1, result.getCount()); final Geocache cache = result.getFirstCacheFromResult(LoadFlags.LOAD_CACHE_OR_DB); + assertNotNull(cache); + assert (cache != null); // eclipse bug assertEquals(cacheName, cache.getName()); } @@ -155,16 +156,20 @@ public class GCParserTest extends AbstractResourceInstrumentationTestCase { cache.setGeocode("GC2ZN4G"); // upload coordinates GCParser.editModifiedCoordinates(cache, new Geopoint("N51 21.544", "E07 02.566")); - cache.drop(new Handler()); + cache.dropSynchronous(); final String page = GCParser.requestHtmlPage(cache.getGeocode(), null, "n", "0"); final Geocache cache2 = GCParser.parseCacheFromText(page, null).getFirstCacheFromResult(LoadFlags.LOAD_CACHE_ONLY); + assertNotNull(cache2); + assert (cache2 != null); // eclipse bug assertTrue(cache2.hasUserModifiedCoords()); assertEquals(new Geopoint("N51 21.544", "E07 02.566"), cache2.getCoords()); // delete coordinates GCParser.deleteModifiedCoordinates(cache2); - cache2.drop(new Handler()); + cache2.dropSynchronous(); final String page2 = GCParser.requestHtmlPage(cache.getGeocode(), null, "n", "0"); final Geocache cache3 = GCParser.parseCacheFromText(page2, null).getFirstCacheFromResult(LoadFlags.LOAD_CACHE_ONLY); + assertNotNull(cache3); + assert (cache3 != null); // eclipse bug assertFalse(cache3.hasUserModifiedCoords()); } @@ -172,9 +177,10 @@ public class GCParserTest extends AbstractResourceInstrumentationTestCase { cache.setPersonalNote(note); cache.setWaypoints(new ArrayList<Waypoint>(), false); cache.parseWaypointsFromNote(); - assertEquals(expected.length, cache.getWaypoints().size()); + final List<Waypoint> waypoints = cache.getWaypoints(); + assertEquals(expected.length, waypoints.size()); for (int i = 0; i < expected.length; i++) { - assertTrue(expected[i].equals(cache.getWaypoint(i).getCoords())); + assertTrue(expected[i].equals(waypoints.get(i).getCoords())); } } |
