aboutsummaryrefslogtreecommitdiffstats
path: root/tests/src/cgeo/geocaching/connector/gc/GCParserTest.java
diff options
context:
space:
mode:
authorBananeweizen <bananeweizen@gmx.de>2012-06-24 09:57:50 +0200
committerBananeweizen <bananeweizen@gmx.de>2012-06-24 09:57:50 +0200
commit9a2e705e968434da0abfd4a636941cfadc0a5a22 (patch)
treec44dc509f3218e2ae5c1d3a1c7ce987d343f1d29 /tests/src/cgeo/geocaching/connector/gc/GCParserTest.java
parent41bb57de4796cf1935b256df9801e3be860d840c (diff)
downloadcgeo-9a2e705e968434da0abfd4a636941cfadc0a5a22.zip
cgeo-9a2e705e968434da0abfd4a636941cfadc0a5a22.tar.gz
cgeo-9a2e705e968434da0abfd4a636941cfadc0a5a22.tar.bz2
fix #1792: Missing own spoiler images
Diffstat (limited to 'tests/src/cgeo/geocaching/connector/gc/GCParserTest.java')
-rw-r--r--tests/src/cgeo/geocaching/connector/gc/GCParserTest.java17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/src/cgeo/geocaching/connector/gc/GCParserTest.java b/tests/src/cgeo/geocaching/connector/gc/GCParserTest.java
index 54f69ce..dd4ae9d 100644
--- a/tests/src/cgeo/geocaching/connector/gc/GCParserTest.java
+++ b/tests/src/cgeo/geocaching/connector/gc/GCParserTest.java
@@ -3,6 +3,7 @@ package cgeo.geocaching.connector.gc;
import cgeo.geocaching.SearchResult;
import cgeo.geocaching.Settings;
import cgeo.geocaching.cgCache;
+import cgeo.geocaching.cgImage;
import cgeo.geocaching.cgWaypoint;
import cgeo.geocaching.enumerations.LoadFlags;
import cgeo.geocaching.enumerations.StatusCode;
@@ -14,6 +15,7 @@ import cgeo.geocaching.test.mock.MockedCache;
import cgeo.geocaching.utils.CancellableHandler;
import cgeo.test.Compare;
+import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import android.test.suitebuilder.annotation.MediumTest;
@@ -29,6 +31,21 @@ public class GCParserTest extends AbstractResourceInstrumentationTestCase {
assertEquals(StatusCode.UNPUBLISHED_CACHE, result.getError());
}
+ 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);
+ assertNotNull(cache);
+ assertTrue(CollectionUtils.isNotEmpty(cache.getSpoilers()));
+ assertEquals(1, cache.getSpoilers().size());
+ final cgImage spoiler = cache.getSpoilers().get(0);
+ assertEquals("http://img.geocaching.com/cache/large/3f9365c3-f55c-4e55-9992-ee0e5175712c.jpg", spoiler.getUrl());
+ assertEquals("SPOILER", spoiler.getTitle());
+ assertNull(spoiler.getDescription());
+ }
+
private static cgCache createCache(int index) {
final MockedCache mockedCache = RegExPerformanceTest.MOCKED_CACHES[index];
// to get the same results we have to use the date format used when the mocked data was created