diff options
Diffstat (limited to 'tests/src')
| -rw-r--r-- | tests/src/cgeo/geocaching/ParserTest.java | 2 | ||||
| -rw-r--r-- | tests/src/cgeo/geocaching/cgWaypointTest.java | 12 | ||||
| -rw-r--r-- | tests/src/cgeo/geocaching/cgeoApplicationTest.java | 15 | ||||
| -rw-r--r-- | tests/src/cgeo/geocaching/cgeogpxesTest.java | 2 | ||||
| -rw-r--r-- | tests/src/cgeo/geocaching/files/GPXParserTest.java | 102 | ||||
| -rw-r--r-- | tests/src/cgeo/geocaching/files/LocParserTest.java | 18 | ||||
| -rw-r--r-- | tests/src/cgeo/geocaching/geopoint/DistanceParserTest.java | 2 | ||||
| -rw-r--r-- | tests/src/cgeo/geocaching/sorting/NameComparatorTest.java | 2 | ||||
| -rw-r--r-- | tests/src/cgeo/geocaching/test/mock/GC1ZXX2.java | 4 | ||||
| -rw-r--r-- | tests/src/cgeo/geocaching/test/mock/GC2CJPF.java | 4 | ||||
| -rw-r--r-- | tests/src/cgeo/geocaching/test/mock/GC2JVEH.java | 4 |
11 files changed, 84 insertions, 83 deletions
diff --git a/tests/src/cgeo/geocaching/ParserTest.java b/tests/src/cgeo/geocaching/ParserTest.java index 1f61554..ca4a171 100644 --- a/tests/src/cgeo/geocaching/ParserTest.java +++ b/tests/src/cgeo/geocaching/ParserTest.java @@ -18,6 +18,6 @@ public class ParserTest extends InstrumentationTestCase { cgCacheWrap caches = cgBase.parseCacheFromText(getFileContent(R.raw.gc1zxez), 0, null); assertEquals(1, caches.cacheList.size()); final cgCache cache = caches.cacheList.get(0); - assertEquals("Ms.Marple/Mr.Stringer", cache.ownerReal); + assertEquals("Ms.Marple/Mr.Stringer", cache.getOwnerReal()); } }
\ No newline at end of file diff --git a/tests/src/cgeo/geocaching/cgWaypointTest.java b/tests/src/cgeo/geocaching/cgWaypointTest.java index 84f8f9d..241b349 100644 --- a/tests/src/cgeo/geocaching/cgWaypointTest.java +++ b/tests/src/cgeo/geocaching/cgWaypointTest.java @@ -8,22 +8,22 @@ public class cgWaypointTest extends AndroidTestCase { public static void testOrder() { final cgWaypoint cache = new cgWaypoint(); - cache.type = WaypointType.FINAL; + cache.setWaypointType(WaypointType.FINAL); final cgWaypoint trailhead = new cgWaypoint(); - trailhead.type = WaypointType.TRAILHEAD; + trailhead.setWaypointType(WaypointType.TRAILHEAD); final cgWaypoint stage = new cgWaypoint(); - stage.type = WaypointType.STAGE; + stage.setWaypointType(WaypointType.STAGE); final cgWaypoint puzzle = new cgWaypoint(); - puzzle.type = WaypointType.PUZZLE; + puzzle.setWaypointType(WaypointType.PUZZLE); final cgWaypoint own = new cgWaypoint(); - own.type = WaypointType.OWN; + own.setWaypointType(WaypointType.OWN); final cgWaypoint parking = new cgWaypoint(); - parking.type = WaypointType.PARKING; + parking.setWaypointType(WaypointType.PARKING); assertTrue(trailhead.compareTo(puzzle) < 0); assertTrue(trailhead.compareTo(stage) < 0); diff --git a/tests/src/cgeo/geocaching/cgeoApplicationTest.java b/tests/src/cgeo/geocaching/cgeoApplicationTest.java index 9c63261..3dcf2e3 100644 --- a/tests/src/cgeo/geocaching/cgeoApplicationTest.java +++ b/tests/src/cgeo/geocaching/cgeoApplicationTest.java @@ -67,7 +67,7 @@ public class cgeoApplicationTest extends ApplicationTestCase<cgeoapplication> { cgCacheWrap caches = cgBase.parseCacheFromText(cache.getData(), 0, null); cgCache cacheParsed = caches.cacheList.get(0); Assert.assertEquals(cache.getGeocode(), cacheParsed.getGeocode()); - Assert.assertEquals(cache.getType(), cacheParsed.getType()); + Assert.assertEquals(cache.getCacheType(), cacheParsed.getCacheType()); Assert.assertEquals(cache.getOwner(), cacheParsed.getOwner()); Assert.assertEquals(cache.getDifficulty(), cacheParsed.getDifficulty()); Assert.assertEquals(cache.getTerrain(), cacheParsed.getTerrain()); @@ -117,22 +117,25 @@ public class cgeoApplicationTest extends ApplicationTestCase<cgeoapplication> { public void testSearchTrackable() { cgTrackable tb = base.searchTrackable("TB2J1VZ", null, null); + // fix data assertEquals("aefffb86-099f-444f-b132-605436163aa8", tb.getGuid()); assertEquals("TB2J1VZ", tb.getGeocode()); assertEquals("http://www.geocaching.com/images/wpttypes/21.gif", tb.getIconUrl()); assertEquals("blafoo's Children Music CD", tb.getName()); assertEquals("Travel Bug Dog Tag", tb.getType()); assertEquals(new Date(2009 - 1900, 8 - 1, 24), tb.getReleased()); - assertEquals(10617.8f, tb.getDistance()); assertEquals("Niedersachsen, Germany", tb.getOrigin()); assertEquals("blafoo", tb.getOwner()); assertEquals("0564a940-8311-40ee-8e76-7e91b2cf6284", tb.getOwnerGuid()); - assertEquals("Nice place for a break cache", tb.getSpottedName()); - assertEquals(cgTrackable.SPOTTED_CACHE, tb.getSpottedType()); - assertEquals("faa2d47d-19ea-422f-bec8-318fc82c8063", tb.getSpottedGuid()); assertEquals("Kinder erfreuen.<br/><br/>Make children happy.", tb.getGoal()); assertTrue(tb.getDetails().startsWith("Auf der CD sind")); assertEquals("http://img.geocaching.com/track/display/38382780-87a7-4393-8393-78841678ee8c.jpg", tb.getImage()); - assertEquals(10, tb.getLogs().size()); + // changing data + assertTrue(tb.getDistance() >= 10617.8f); + assertTrue(tb.getLogs().size() >= 10); + assertTrue(cgTrackable.SPOTTED_CACHE == tb.getSpottedType() || cgTrackable.SPOTTED_OWNER == tb.getSpottedType()); + // no assumption possible: assertEquals("faa2d47d-19ea-422f-bec8-318fc82c8063", tb.getSpottedGuid()); + // no assumption possible: assertEquals("Nice place for a break cache", tb.getSpottedName()); + } } diff --git a/tests/src/cgeo/geocaching/cgeogpxesTest.java b/tests/src/cgeo/geocaching/cgeogpxesTest.java index 7d9a0de..90ce201 100644 --- a/tests/src/cgeo/geocaching/cgeogpxesTest.java +++ b/tests/src/cgeo/geocaching/cgeogpxesTest.java @@ -153,7 +153,7 @@ public class cgeogpxesTest extends ActivityInstrumentationTestCase2<cgeogpxes> { cgCache cache = cgeoapplication.getInstance().getCacheByGeocode("GC31J2H"); assertNotNull(cache); - assertEquals(2, cache.waypoints.size()); + assertEquals(2, cache.getWaypoints().size()); } public void testImportLoc() throws IOException { diff --git a/tests/src/cgeo/geocaching/files/GPXParserTest.java b/tests/src/cgeo/geocaching/files/GPXParserTest.java index 8fed2ae..c3e253a 100644 --- a/tests/src/cgeo/geocaching/files/GPXParserTest.java +++ b/tests/src/cgeo/geocaching/files/GPXParserTest.java @@ -34,43 +34,43 @@ public class GPXParserTest extends InstrumentationTestCase { assertNotNull(caches); assertEquals(1, caches.size()); final cgCache cache = caches.get(0); - assertEquals("GC1BKP3", cache.geocode); - assertEquals("9946f030-a514-46d8-a050-a60e92fd2e1a", cache.guid); - assertEquals(CacheType.TRADITIONAL.id, cache.type); - assertEquals(false, cache.archived); - assertEquals(false, cache.disabled); - assertEquals("Die Schatzinsel / treasure island", cache.name); - assertEquals("Die unbesiegbaren Geo - Geparden", cache.owner); - assertEquals(CacheSize.MICRO, cache.size); - assertEquals(1.0f, cache.difficulty.floatValue()); - assertEquals(5.0f, cache.terrain.floatValue()); - assertEquals("Baden-Württemberg, Germany", cache.location); - assertEquals("Ein alter Kindheitstraum, ein Schatz auf einer unbewohnten Insel.\nA old dream of my childhood, a treasure on a lonely island.", cache.shortdesc); - assertTrue(new Geopoint(48.859683, 9.1874).isEqualTo(cache.coords)); + assertEquals("GC1BKP3", cache.getGeocode()); + assertEquals("9946f030-a514-46d8-a050-a60e92fd2e1a", cache.getGuid()); + assertEquals(CacheType.TRADITIONAL.id, cache.getType()); + assertEquals(false, cache.isArchived()); + assertEquals(false, cache.isDisabled()); + assertEquals("Die Schatzinsel / treasure island", cache.getName()); + assertEquals("Die unbesiegbaren Geo - Geparden", cache.getOwner()); + assertEquals(CacheSize.MICRO, cache.getSize()); + assertEquals(1.0f, cache.getDifficulty().floatValue()); + assertEquals(5.0f, cache.getTerrain().floatValue()); + assertEquals("Baden-Württemberg, Germany", cache.getLocation()); + assertEquals("Ein alter Kindheitstraum, ein Schatz auf einer unbewohnten Insel.\nA old dream of my childhood, a treasure on a lonely island.", cache.getShortdesc()); + assertTrue(new Geopoint(48.859683, 9.1874).isEqualTo(cache.getCoords())); return cache; } public void testGPXVersion101() throws IOException, ParserException { final cgCache cache = testGPXVersion(R.raw.gc1bkp3_gpx101); - assertNotNull(cache.attributes); - assertEquals(10, cache.attributes.size()); + assertNotNull(cache.getAttributes()); + assertEquals(10, cache.getAttributes().size()); } public void testOC() throws IOException, ParserException { final List<cgCache> caches = readGPX(R.raw.oc5952_gpx); final cgCache cache = caches.get(0); - assertEquals("OC5952", cache.geocode); - assertEquals(CacheType.TRADITIONAL.id, cache.type); - assertEquals(false, cache.archived); - assertEquals(false, cache.disabled); - assertEquals("Die Schatzinsel / treasure island", cache.name); - assertEquals("Die unbesiegbaren Geo - Geparden", cache.owner); - assertEquals(CacheSize.SMALL, cache.size); - assertEquals(1.0f, cache.difficulty.floatValue()); - assertEquals(4.0f, cache.terrain.floatValue()); - assertEquals("Baden-Württemberg, Germany", cache.location); - assertEquals("Ein alter Kindheitstraum, ein Schatz auf einer unbewohnten Insel. A old dream of my childhood, a treasure on a lonely is", cache.shortdesc); - assertTrue(new Geopoint(48.85968, 9.18740).isEqualTo(cache.coords)); + assertEquals("OC5952", cache.getGeocode()); + assertEquals(CacheType.TRADITIONAL.id, cache.getType()); + assertEquals(false, cache.isArchived()); + assertEquals(false, cache.isDisabled()); + assertEquals("Die Schatzinsel / treasure island", cache.getName()); + assertEquals("Die unbesiegbaren Geo - Geparden", cache.getOwner()); + assertEquals(CacheSize.SMALL, cache.getSize()); + assertEquals(1.0f, cache.getDifficulty().floatValue()); + assertEquals(4.0f, cache.getTerrain().floatValue()); + assertEquals("Baden-Württemberg, Germany", cache.getLocation()); + assertEquals("Ein alter Kindheitstraum, ein Schatz auf einer unbewohnten Insel. A old dream of my childhood, a treasure on a lonely is", cache.getShortdesc()); + assertTrue(new Geopoint(48.85968, 9.18740).isEqualTo(cache.getCoords())); } public void testGc31j2h() throws IOException, ParserException { @@ -82,7 +82,7 @@ public class GPXParserTest extends InstrumentationTestCase { assertSame(cache, caches.get(0)); // no waypoints without importing waypoint file - assertNull(cache.waypoints); + assertNull(cache.getWaypoints()); } public void testGc31j2hWpts() throws IOException, ParserException { @@ -128,18 +128,18 @@ public class GPXParserTest extends InstrumentationTestCase { assertFalse(cache.isEventCache()); assertFalse(cache.isMembersOnly()); assertFalse(cache.isOwn()); - assertTrue(cache.found); + assertTrue(cache.isFound()); assertEquals("Station3: Der zerbrochene Stein zählt doppelt.\nFinal: Oben neben dem Tor", cache.getHint()); // logs - assertEquals(6, cache.logs.size()); - final cgLog log = cache.logs.get(5); + assertEquals(6, cache.getLogs().size()); + final cgLog log = cache.getLogs().get(5); assertEquals("Geoteufel", log.author); assertEquals(parseTime("2011-09-11T07:00:00Z"), log.date); assertEquals(-1, log.found); assertEquals("Sehr schöne Runde und wir haben wieder etwas Neues über Hockenheim gelernt. Super Tarnung.\nTFTC, Geoteufel", log.log); // following info is not contained in pocket query gpx file - assertNull(cache.attributes); + assertNull(cache.getAttributes()); } private static long parseTime(final String time) { @@ -151,27 +151,27 @@ public class GPXParserTest extends InstrumentationTestCase { } private static void assertGc31j2hWaypoints(final cgCache cache) { - assertNotNull(cache.waypoints); - assertEquals(2, cache.waypoints.size()); - cgWaypoint wp = cache.waypoints.get(0); - assertEquals("GC31J2H", wp.geocode); + assertNotNull(cache.getWaypoints()); + assertEquals(2, cache.getWaypoints().size()); + cgWaypoint wp = cache.getWaypoints().get(0); + assertEquals("GC31J2H", wp.getGeocode()); assertEquals("00", wp.getPrefix()); - assertEquals("---", wp.lookup); - assertEquals("Parkplatz", wp.name); - assertEquals("Kostenfreies Parken (je nach Parkreihe Parkscheibe erforderlich)", wp.note); - assertEquals(WaypointType.PARKING, wp.type); - assertEquals(49.317517, wp.coords.getLatitude(), 0.000001); - assertEquals(8.545083, wp.coords.getLongitude(), 0.000001); - - wp = cache.waypoints.get(1); - assertEquals("GC31J2H", wp.geocode); + assertEquals("---", wp.getLookup()); + assertEquals("Parkplatz", wp.getName()); + assertEquals("Kostenfreies Parken (je nach Parkreihe Parkscheibe erforderlich)", wp.getNote()); + assertEquals(WaypointType.PARKING, wp.getWaypointType()); + assertEquals(49.317517, wp.getCoords().getLatitude(), 0.000001); + assertEquals(8.545083, wp.getCoords().getLongitude(), 0.000001); + + wp = cache.getWaypoints().get(1); + assertEquals("GC31J2H", wp.getGeocode()); assertEquals("S1", wp.getPrefix()); - assertEquals("---", wp.lookup); - assertEquals("Station 1", wp.name); - assertEquals("Ein zweiter Wegpunkt, der nicht wirklich existiert sondern nur zum Testen gedacht ist.", wp.note); - assertEquals(WaypointType.STAGE, wp.type); - assertEquals(49.317500, wp.coords.getLatitude(), 0.000001); - assertEquals(8.545100, wp.coords.getLongitude(), 0.000001); + assertEquals("---", wp.getLookup()); + assertEquals("Station 1", wp.getName()); + assertEquals("Ein zweiter Wegpunkt, der nicht wirklich existiert sondern nur zum Testen gedacht ist.", wp.getNote()); + assertEquals(WaypointType.STAGE, wp.getWaypointType()); + assertEquals(49.317500, wp.getCoords().getLatitude(), 0.000001); + assertEquals(8.545100, wp.getCoords().getLongitude(), 0.000001); } private List<cgCache> readGPX(int... resourceIds) throws IOException, ParserException { diff --git a/tests/src/cgeo/geocaching/files/LocParserTest.java b/tests/src/cgeo/geocaching/files/LocParserTest.java index 9b633e3..6fa8182 100644 --- a/tests/src/cgeo/geocaching/files/LocParserTest.java +++ b/tests/src/cgeo/geocaching/files/LocParserTest.java @@ -39,9 +39,9 @@ public class LocParserTest extends InstrumentationTestCase { assertEquals(1, caches.size()); final cgCache cache = caches.get(0); assertNotNull(cache); - assertEquals("OC5952", cache.geocode); - assertEquals("Die Schatzinsel / treasure island", cache.name); - assertTrue(new Geopoint(48.85968, 9.18740).isEqualTo(cache.coords)); + assertEquals("OC5952", cache.getGeocode()); + assertEquals("Die Schatzinsel / treasure island", cache.getName()); + assertTrue(new Geopoint(48.85968, 9.18740).isEqualTo(cache.getCoords())); } public void testGCLoc() throws IOException, ParserException { @@ -49,11 +49,11 @@ public class LocParserTest extends InstrumentationTestCase { assertEquals(1, caches.size()); final cgCache cache = caches.get(0); assertNotNull(cache); - assertEquals("GC1BKP3", cache.geocode); - assertEquals("Die Schatzinsel / treasure island", cache.name); - assertTrue(new Geopoint(48.859683, 9.1874).isEqualTo(cache.coords)); - assertEquals(1.0f, cache.difficulty.floatValue()); - assertEquals(5.0f, cache.terrain.floatValue()); - assertEquals(CacheSize.MICRO, cache.size); + assertEquals("GC1BKP3", cache.getGeocode()); + assertEquals("Die Schatzinsel / treasure island", cache.getName()); + assertTrue(new Geopoint(48.859683, 9.1874).isEqualTo(cache.getCoords())); + assertEquals(1.0f, cache.getDifficulty().floatValue()); + assertEquals(5.0f, cache.getTerrain().floatValue()); + assertEquals(CacheSize.MICRO, cache.getSize()); } } diff --git a/tests/src/cgeo/geocaching/geopoint/DistanceParserTest.java b/tests/src/cgeo/geocaching/geopoint/DistanceParserTest.java index 357d34c..52a1080 100644 --- a/tests/src/cgeo/geocaching/geopoint/DistanceParserTest.java +++ b/tests/src/cgeo/geocaching/geopoint/DistanceParserTest.java @@ -1,7 +1,5 @@ package cgeo.geocaching.geopoint; -import cgeo.geocaching.geopoint.DistanceParser; - import android.test.AndroidTestCase; import junit.framework.Assert; diff --git a/tests/src/cgeo/geocaching/sorting/NameComparatorTest.java b/tests/src/cgeo/geocaching/sorting/NameComparatorTest.java index eb496e4..fa3b16c 100644 --- a/tests/src/cgeo/geocaching/sorting/NameComparatorTest.java +++ b/tests/src/cgeo/geocaching/sorting/NameComparatorTest.java @@ -9,7 +9,7 @@ public class NameComparatorTest extends AndroidTestCase { private static class NamedCache extends cgCache { public NamedCache(final String name) { - this.name = name; + this.setName(name); } } diff --git a/tests/src/cgeo/geocaching/test/mock/GC1ZXX2.java b/tests/src/cgeo/geocaching/test/mock/GC1ZXX2.java index 6d63b18..e7abb48 100644 --- a/tests/src/cgeo/geocaching/test/mock/GC1ZXX2.java +++ b/tests/src/cgeo/geocaching/test/mock/GC1ZXX2.java @@ -50,8 +50,8 @@ public class GC1ZXX2 extends MockedCache { } @Override - public String getType() { - return CacheType.TRADITIONAL.id; + public CacheType getCacheType() { + return CacheType.TRADITIONAL; } @Override diff --git a/tests/src/cgeo/geocaching/test/mock/GC2CJPF.java b/tests/src/cgeo/geocaching/test/mock/GC2CJPF.java index 6ef2406..f44f560 100644 --- a/tests/src/cgeo/geocaching/test/mock/GC2CJPF.java +++ b/tests/src/cgeo/geocaching/test/mock/GC2CJPF.java @@ -54,8 +54,8 @@ public class GC2CJPF extends MockedCache { } @Override - public String getType() { - return CacheType.MULTI.id; + public CacheType getCacheType() { + return CacheType.MULTI; } @Override diff --git a/tests/src/cgeo/geocaching/test/mock/GC2JVEH.java b/tests/src/cgeo/geocaching/test/mock/GC2JVEH.java index 38bce01..faf3ca8 100644 --- a/tests/src/cgeo/geocaching/test/mock/GC2JVEH.java +++ b/tests/src/cgeo/geocaching/test/mock/GC2JVEH.java @@ -67,8 +67,8 @@ public class GC2JVEH extends MockedCache { } @Override - public String getType() { - return CacheType.MYSTERY.id; + public CacheType getCacheType() { + return CacheType.MYSTERY; } @Override |
