diff options
author | Bananeweizen <bananeweizen@gmx.de> | 2013-12-16 12:48:31 +0100 |
---|---|---|
committer | Bananeweizen <bananeweizen@gmx.de> | 2013-12-16 12:48:31 +0100 |
commit | fc124633817d4d15cd6bf58487f19a1d73e64459 (patch) | |
tree | b3208a5c12fc2136bc0f38fe8ee7bc78b141d1ca /tests/src/cgeo/geocaching | |
parent | 14874d409a6547bc36c3b3946d55a81ad61da97a (diff) | |
download | cgeo-fc124633817d4d15cd6bf58487f19a1d73e64459.zip cgeo-fc124633817d4d15cd6bf58487f19a1d73e64459.tar.gz cgeo-fc124633817d4d15cd6bf58487f19a1d73e64459.tar.bz2 |
integrate extremcaching.com
* cherry-pick existing commits and have some basic tests
* disable EC connector by default
* fix faked geocodes during GPX import
* parse wrongly encoded container size
Diffstat (limited to 'tests/src/cgeo/geocaching')
-rw-r--r-- | tests/src/cgeo/geocaching/connector/ec/ECConnectorTest.java | 33 | ||||
-rw-r--r-- | tests/src/cgeo/geocaching/enumerations/CacheSizeTest.java | 7 |
2 files changed, 40 insertions, 0 deletions
diff --git a/tests/src/cgeo/geocaching/connector/ec/ECConnectorTest.java b/tests/src/cgeo/geocaching/connector/ec/ECConnectorTest.java new file mode 100644 index 0000000..4b9ae37 --- /dev/null +++ b/tests/src/cgeo/geocaching/connector/ec/ECConnectorTest.java @@ -0,0 +1,33 @@ +package cgeo.geocaching.connector.ec; + +import cgeo.geocaching.Geocache; +import cgeo.geocaching.enumerations.CacheType; +import cgeo.geocaching.enumerations.LogType; + +import java.util.List; + +import junit.framework.TestCase; + +public class ECConnectorTest extends TestCase { + + public static void testCanHandle() throws Exception { + assertTrue(ECConnector.getInstance().canHandle("EC380")); + assertFalse(ECConnector.getInstance().canHandle("GC380")); + assertFalse("faked EC codes must be handled during the import, otherwise GCECxxxx codes belong to 2 connectors", ECConnector.getInstance().canHandle("GCEC380")); + } + + public static void testGetPossibleLogTypes() throws Exception { + final List<LogType> possibleLogTypes = ECConnector.getInstance().getPossibleLogTypes(createCache()); + assertNotNull(possibleLogTypes); + assertFalse(possibleLogTypes.isEmpty()); + assertTrue(possibleLogTypes.contains(LogType.FOUND_IT)); + } + + private static Geocache createCache() { + final Geocache geocache = new Geocache(); + geocache.setType(CacheType.TRADITIONAL); + geocache.setGeocode("EC727"); + return geocache; + } + +} diff --git a/tests/src/cgeo/geocaching/enumerations/CacheSizeTest.java b/tests/src/cgeo/geocaching/enumerations/CacheSizeTest.java index 9c3063d..2f11dfc 100644 --- a/tests/src/cgeo/geocaching/enumerations/CacheSizeTest.java +++ b/tests/src/cgeo/geocaching/enumerations/CacheSizeTest.java @@ -27,4 +27,11 @@ public class CacheSizeTest extends AndroidTestCase { assertEquals(size, CacheSize.getById(size.id.toUpperCase(Locale.US))); } } + + public static void testGetByIdNumeric() { + assertEquals(CacheSize.REGULAR, CacheSize.getById("3")); + assertEquals(CacheSize.UNKNOWN, CacheSize.getById("0")); + assertEquals(CacheSize.UNKNOWN, CacheSize.getById("9")); + assertEquals(CacheSize.UNKNOWN, CacheSize.getById("-1")); + } } |