diff options
| author | Bananeweizen <bananeweizen@gmx.de> | 2012-11-17 08:56:04 +0100 |
|---|---|---|
| committer | Bananeweizen <bananeweizen@gmx.de> | 2012-11-17 08:56:04 +0100 |
| commit | 5034aa1042d0349c3d6ae7b7d56ee88d43b13df7 (patch) | |
| tree | 0caf80f8cdb0180ff23b519040d8ff8d39ccee52 /tests/src/cgeo/geocaching/connector/gc/GCParserTest.java | |
| parent | 801d04a7965d37c4bfa66a9d38043d0a3d874915 (diff) | |
| download | cgeo-5034aa1042d0349c3d6ae7b7d56ee88d43b13df7.zip cgeo-5034aa1042d0349c3d6ae7b7d56ee88d43b13df7.tar.gz cgeo-5034aa1042d0349c3d6ae7b7d56ee88d43b13df7.tar.bz2 | |
fix #2166: Refresh of a stored caches duplicates waypoints
Diffstat (limited to 'tests/src/cgeo/geocaching/connector/gc/GCParserTest.java')
| -rw-r--r-- | tests/src/cgeo/geocaching/connector/gc/GCParserTest.java | 22 |
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); + } + } |
