diff options
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")); + } } |