aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--main/src/cgeo/geocaching/enumerations/CacheType.java5
-rw-r--r--tests/src/cgeo/geocaching/files/GPXParserTest.java12
2 files changed, 16 insertions, 1 deletions
diff --git a/main/src/cgeo/geocaching/enumerations/CacheType.java b/main/src/cgeo/geocaching/enumerations/CacheType.java
index 535bfab..61ad2c2 100644
--- a/main/src/cgeo/geocaching/enumerations/CacheType.java
+++ b/main/src/cgeo/geocaching/enumerations/CacheType.java
@@ -16,7 +16,7 @@ public enum CacheType {
TRADITIONAL("traditional", "Traditional Cache", "32bc9333-5e52-4957-b0f6-5a2c8fc7b257", R.string.traditional, R.drawable.type_traditional),
MULTI("multi", "Multi-cache", "a5f6d0ad-d2f2-4011-8c14-940a9ebf3c74", R.string.multi, R.drawable.type_multi),
- MYSTERY("mystery", "Unknown Cache", "40861821-1835-4e11-b666-8d41064d03fe", R.string.mystery, R.drawable.type_mystery),
+ MYSTERY("mystery", "Mystery Cache", "40861821-1835-4e11-b666-8d41064d03fe", R.string.mystery, R.drawable.type_mystery),
LETTERBOX("letterbox", "Letterbox hybrid", "4bdd8fb2-d7bc-453f-a9c5-968563b15d24", R.string.letterbox, R.drawable.type_letterbox),
EVENT("event", "Event Cache", "69eb8534-b718-4b35-ae3c-a856a55b0874", R.string.event, R.drawable.type_event),
MEGA_EVENT("mega", "Mega-Event Cache", "69eb8535-b718-4b35-ae3c-a856a55b0874", R.string.mega, R.drawable.type_mega),
@@ -68,6 +68,9 @@ public enum CacheType {
mappingPattern.put(ct.pattern.toLowerCase(Locale.US), ct);
mappingGuid.put(ct.guid, ct);
}
+ // add old mystery type for GPX file compatibility
+ mappingPattern.put("Unknown Cache".toLowerCase(Locale.US), MYSTERY);
+
FIND_BY_ID = Collections.unmodifiableMap(mappingId);
FIND_BY_PATTERN = Collections.unmodifiableMap(mappingPattern);
FIND_BY_GUID = Collections.unmodifiableMap(mappingGuid);
diff --git a/tests/src/cgeo/geocaching/files/GPXParserTest.java b/tests/src/cgeo/geocaching/files/GPXParserTest.java
index 08e2662..bb91243 100644
--- a/tests/src/cgeo/geocaching/files/GPXParserTest.java
+++ b/tests/src/cgeo/geocaching/files/GPXParserTest.java
@@ -375,4 +375,16 @@ public class GPXParserTest extends AbstractResourceInstrumentationTestCase {
assertThat(cache.isPremiumMembersOnly()).isTrue();
}
+ public void testGPXMysteryType() throws IOException, ParserException {
+ final List<Geocache> caches = readGPX10(R.raw.tc2012);
+ Geocache mystery = null;
+ for (Geocache geocache : caches) {
+ if (geocache.getName().equals("U017")) {
+ mystery = geocache;
+ }
+ }
+ assertThat(mystery).isNotNull();
+ assert (mystery != null);
+ assertThat(mystery.getType()).isEqualTo(CacheType.MYSTERY);
+ }
}