aboutsummaryrefslogtreecommitdiffstats
path: root/tests/src
diff options
context:
space:
mode:
Diffstat (limited to 'tests/src')
-rw-r--r--tests/src/cgeo/geocaching/connector/gc/GCParserTest.java22
1 files changed, 17 insertions, 5 deletions
diff --git a/tests/src/cgeo/geocaching/connector/gc/GCParserTest.java b/tests/src/cgeo/geocaching/connector/gc/GCParserTest.java
index dd4ae9d..c8cb8fb 100644
--- a/tests/src/cgeo/geocaching/connector/gc/GCParserTest.java
+++ b/tests/src/cgeo/geocaching/connector/gc/GCParserTest.java
@@ -32,11 +32,7 @@ public class GCParserTest extends AbstractResourceInstrumentationTestCase {
}
public void testOwnCache() {
- final String page = getFileContent(R.raw.own_cache);
- SearchResult result = GCParser.parseCacheFromText(page, null);
- assertNotNull(result);
- assertFalse(result.isEmpty());
- final cgCache cache = result.getFirstCacheFromResult(LoadFlags.LOAD_CACHE_OR_DB);
+ final cgCache cache = parseCache(R.raw.own_cache);
assertNotNull(cache);
assertTrue(CollectionUtils.isNotEmpty(cache.getSpoilers()));
assertEquals(1, cache.getSpoilers().size());
@@ -135,4 +131,20 @@ public class GCParserTest extends AbstractResourceInstrumentationTestCase {
}
}
+ public void testWaypointParsing() {
+ cgCache cache = parseCache(R.raw.gc366bq);
+ assertEquals(13, cache.getWaypoints().size());
+ //make sure that waypoints are not duplicated
+ cache = parseCache(R.raw.gc366bq);
+ assertEquals(13, cache.getWaypoints().size());
+ }
+
+ private cgCache parseCache(int resourceId) {
+ final String page = getFileContent(resourceId);
+ SearchResult result = GCParser.parseCacheFromText(page, null);
+ assertNotNull(result);
+ assertFalse(result.isEmpty());
+ return result.getFirstCacheFromResult(LoadFlags.LOAD_CACHE_OR_DB);
+ }
+
}