diff options
Diffstat (limited to 'tests/src/cgeo/geocaching')
| -rw-r--r-- | tests/src/cgeo/geocaching/files/GPXParserTest.java | 14 | ||||
| -rw-r--r-- | tests/src/cgeo/geocaching/files/LocParserTest.java | 19 | ||||
| -rw-r--r-- | tests/src/cgeo/geocaching/utils/CryptUtilsTest.java | 2 |
3 files changed, 35 insertions, 0 deletions
diff --git a/tests/src/cgeo/geocaching/files/GPXParserTest.java b/tests/src/cgeo/geocaching/files/GPXParserTest.java index 8fd962e..5732f9a 100644 --- a/tests/src/cgeo/geocaching/files/GPXParserTest.java +++ b/tests/src/cgeo/geocaching/files/GPXParserTest.java @@ -13,6 +13,8 @@ import cgeo.geocaching.geopoint.Geopoint; import cgeo.geocaching.test.AbstractResourceInstrumentationTestCase; import cgeo.geocaching.test.R; +import org.apache.commons.lang3.StringUtils; + import java.io.IOException; import java.io.InputStream; import java.text.ParseException; @@ -281,4 +283,16 @@ public class GPXParserTest extends AbstractResourceInstrumentationTestCase { removeCacheCompletely(geocode); } + public void testWaymarking() throws Exception { + final List<Geocache> caches = readGPX10(R.raw.waymarking_gpx); + assertEquals(1, caches.size()); + final Geocache waymark = caches.get(0); + assertNotNull(waymark); + assertEquals("WM7BM7", waymark.getGeocode()); + assertEquals("Roman water pipe Kornwestheim", waymark.getName()); + assertTrue(StringUtils.isNotBlank(waymark.getUrl())); // connector must be able to create it + assertEquals(CacheType.UNKNOWN, waymark.getType()); + assertEquals(CacheSize.UNKNOWN, waymark.getSize()); + } + } diff --git a/tests/src/cgeo/geocaching/files/LocParserTest.java b/tests/src/cgeo/geocaching/files/LocParserTest.java index bcc8e78..6e00b35 100644 --- a/tests/src/cgeo/geocaching/files/LocParserTest.java +++ b/tests/src/cgeo/geocaching/files/LocParserTest.java @@ -2,6 +2,7 @@ package cgeo.geocaching.files; import cgeo.geocaching.Geocache; import cgeo.geocaching.enumerations.CacheSize; +import cgeo.geocaching.enumerations.CacheType; import cgeo.geocaching.geopoint.Geopoint; import cgeo.geocaching.test.AbstractResourceInstrumentationTestCase; import cgeo.geocaching.test.R; @@ -35,6 +36,7 @@ public class LocParserTest extends AbstractResourceInstrumentationTestCase { assertNotNull(cache); assertEquals("OC5952", cache.getGeocode()); assertEquals("Die Schatzinsel / treasure island", cache.getName()); + assertEquals("Die unbesiegbaren Geo - Geparden", cache.getOwnerDisplayName()); assertEquals(new Geopoint(48.85968, 9.18740), cache.getCoords()); } @@ -45,9 +47,26 @@ public class LocParserTest extends AbstractResourceInstrumentationTestCase { assertNotNull(cache); assertEquals("GC1BKP3", cache.getGeocode()); assertEquals("Die Schatzinsel / treasure island", cache.getName()); + assertEquals("Die unbesiegbaren Geo - Geparden", cache.getOwnerDisplayName()); assertEquals(new Geopoint(48.859683, 9.1874), cache.getCoords()); assertEquals(1.0f, cache.getDifficulty()); assertEquals(5.0f, cache.getTerrain()); assertEquals(CacheSize.MICRO, cache.getSize()); } + + public void testWaymarkingLoc() throws IOException, ParserException { + final List<Geocache> waymarks = readLoc(R.raw.waymarking_loc); + assertEquals(1, waymarks.size()); + final Geocache waymark = waymarks.get(0); + assertNotNull(waymark); + assertEquals("WM7BK7", waymark.getGeocode()); + assertEquals("Römerstrasse Kornwestheim", waymark.getName()); + assertEquals("travelling", waymark.getOwnerDisplayName()); + assertEquals(new Geopoint(48.856733, 9.197683), waymark.getCoords()); + // links are not yet stored for single caches + // assertEquals("http://www.waymarking.com/waymarks/WM7BK7_Rmerstrasse_Kornwestheim", waymark.getUrl()); + assertEquals(CacheSize.UNKNOWN, waymark.getSize()); + assertEquals(CacheType.UNKNOWN, waymark.getType()); + } + } diff --git a/tests/src/cgeo/geocaching/utils/CryptUtilsTest.java b/tests/src/cgeo/geocaching/utils/CryptUtilsTest.java index fff24f2..e727747 100644 --- a/tests/src/cgeo/geocaching/utils/CryptUtilsTest.java +++ b/tests/src/cgeo/geocaching/utils/CryptUtilsTest.java @@ -9,6 +9,8 @@ public class CryptUtilsTest extends TestCase { assertEquals("", CryptUtils.rot13("")); assertEquals("", CryptUtils.rot13((String) null)); assertEquals("Pnpur uvag", CryptUtils.rot13("Cache hint")); + assertEquals("Pnpur [plain] uvag", CryptUtils.rot13("Cache [plain] hint")); + assertEquals("[all plain]", CryptUtils.rot13("[all plain]")); assertEquals("123", CryptUtils.rot13("123")); } |
