aboutsummaryrefslogtreecommitdiffstats
path: root/tests/src/cgeo/geocaching/connector/oc
diff options
context:
space:
mode:
Diffstat (limited to 'tests/src/cgeo/geocaching/connector/oc')
-rw-r--r--tests/src/cgeo/geocaching/connector/oc/OCConnectorTest.java25
-rw-r--r--tests/src/cgeo/geocaching/connector/oc/OkapiClientTest.java8
2 files changed, 29 insertions, 4 deletions
diff --git a/tests/src/cgeo/geocaching/connector/oc/OCConnectorTest.java b/tests/src/cgeo/geocaching/connector/oc/OCConnectorTest.java
new file mode 100644
index 0000000..bbbd710
--- /dev/null
+++ b/tests/src/cgeo/geocaching/connector/oc/OCConnectorTest.java
@@ -0,0 +1,25 @@
+package cgeo.geocaching.connector.oc;
+
+import cgeo.geocaching.connector.ConnectorFactory;
+import cgeo.geocaching.connector.IConnector;
+
+import junit.framework.TestCase;
+
+public class OCConnectorTest extends TestCase {
+
+ /**
+ * OC.DE used up the 4 digit/character name space and switched over to 5 recently
+ */
+ public static void testCanHandleNew5DigitCodes() {
+ final IConnector ocConnector = getOcDeConnector();
+ assertTrue(ocConnector.canHandle("OCFFFF"));
+ assertTrue(ocConnector.canHandle("OC10000"));
+ }
+
+ private static IConnector getOcDeConnector() {
+ final IConnector ocConnector = ConnectorFactory.getConnector("OCXXX");
+ assertTrue(ocConnector.getHost().contains(".de"));
+ return ocConnector;
+ }
+
+}
diff --git a/tests/src/cgeo/geocaching/connector/oc/OkapiClientTest.java b/tests/src/cgeo/geocaching/connector/oc/OkapiClientTest.java
index 410252f..eb797c2 100644
--- a/tests/src/cgeo/geocaching/connector/oc/OkapiClientTest.java
+++ b/tests/src/cgeo/geocaching/connector/oc/OkapiClientTest.java
@@ -2,7 +2,7 @@ package cgeo.geocaching.connector.oc;
import cgeo.CGeoTestCase;
import cgeo.geocaching.Geocache;
-import cgeo.geocaching.cgData;
+import cgeo.geocaching.DataStore;
import cgeo.geocaching.enumerations.LoadFlags;
public class OkapiClientTest extends CGeoTestCase {
@@ -10,12 +10,12 @@ public class OkapiClientTest extends CGeoTestCase {
public static void testGetOCCache() {
final String geoCode = "OU0331";
Geocache cache = OkapiClient.getCache(geoCode);
- assertNotNull(cache);
- assertEquals(geoCode, cache.getGeocode());
+ assertNotNull("Did not get cache from OKAPI", cache);
+ assertEquals("Unexpected geo code", geoCode, cache.getGeocode());
assertEquals("Oshkosh Municipal Tank", cache.getName());
assertTrue(cache.isDetailed());
// cache should be stored to DB (to listID 0) when loaded above
- cache = cgData.loadCache(geoCode, LoadFlags.LOAD_ALL_DB_ONLY);
+ cache = DataStore.loadCache(geoCode, LoadFlags.LOAD_ALL_DB_ONLY);
assertNotNull(cache);
assertEquals(geoCode, cache.getGeocode());
assertEquals("Oshkosh Municipal Tank", cache.getName());