aboutsummaryrefslogtreecommitdiffstats
path: root/tests/src/cgeo
diff options
context:
space:
mode:
authorblafoo <github@blafoo.de>2011-10-26 16:52:36 +0200
committerblafoo <github@blafoo.de>2011-10-26 23:25:40 +0200
commita7824dc9af750ebb771e4343423eac1225f9645b (patch)
tree70ce833ba7583b6be1a4f76459ae80820599fdc7 /tests/src/cgeo
parent02701ff1964407b780b8c0be0d69d513ed1cce85 (diff)
downloadcgeo-a7824dc9af750ebb771e4343423eac1225f9645b.zip
cgeo-a7824dc9af750ebb771e4343423eac1225f9645b.tar.gz
cgeo-a7824dc9af750ebb771e4343423eac1225f9645b.tar.bz2
No direct access to fields
Diffstat (limited to 'tests/src/cgeo')
-rw-r--r--tests/src/cgeo/geocaching/ParserTest.java2
-rw-r--r--tests/src/cgeo/geocaching/cgWaypointTest.java12
-rw-r--r--tests/src/cgeo/geocaching/cgeoApplicationTest.java2
-rw-r--r--tests/src/cgeo/geocaching/files/GPXParserTest.java102
-rw-r--r--tests/src/cgeo/geocaching/files/LocParserTest.java18
-rw-r--r--tests/src/cgeo/geocaching/geopoint/DistanceParserTest.java2
-rw-r--r--tests/src/cgeo/geocaching/sorting/NameComparatorTest.java2
-rw-r--r--tests/src/cgeo/geocaching/test/mock/GC1ZXX2.java4
-rw-r--r--tests/src/cgeo/geocaching/test/mock/GC2CJPF.java4
-rw-r--r--tests/src/cgeo/geocaching/test/mock/GC2JVEH.java4
10 files changed, 75 insertions, 77 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..a56c60a 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());
diff --git a/tests/src/cgeo/geocaching/files/GPXParserTest.java b/tests/src/cgeo/geocaching/files/GPXParserTest.java
index 8a229ef..bc795e2 100644
--- a/tests/src/cgeo/geocaching/files/GPXParserTest.java
+++ b/tests/src/cgeo/geocaching/files/GPXParserTest.java
@@ -35,43 +35,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 {
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 {
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 {
@@ -83,7 +83,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 {
@@ -129,18 +129,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) {
@@ -152,27 +152,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);
}
public static void testGetWaypointsFileForGpx() {
diff --git a/tests/src/cgeo/geocaching/files/LocParserTest.java b/tests/src/cgeo/geocaching/files/LocParserTest.java
index 9d90ef4..6e74061 100644
--- a/tests/src/cgeo/geocaching/files/LocParserTest.java
+++ b/tests/src/cgeo/geocaching/files/LocParserTest.java
@@ -44,21 +44,21 @@ public class LocParserTest extends InstrumentationTestCase {
final Map<String, cgCoord> coords = readLoc(R.raw.oc5952_loc);
final cgCoord coord = coords.get("OC5952");
assertNotNull(coord);
- assertEquals("OC5952", coord.geocode);
- assertEquals("Die Schatzinsel / treasure island", coord.name);
- assertTrue(new Geopoint(48.85968, 9.18740).isEqualTo(coord.coords));
+ assertEquals("OC5952", coord.getGeocode());
+ assertEquals("Die Schatzinsel / treasure island", coord.getName());
+ assertTrue(new Geopoint(48.85968, 9.18740).isEqualTo(coord.getCoords()));
}
public void testGCLoc() {
final Map<String, cgCoord> coords = readLoc(R.raw.gc1bkp3_loc);
final cgCoord coord = coords.get("GC1BKP3");
assertNotNull(coord);
- assertEquals("GC1BKP3", coord.geocode);
- assertEquals("Die Schatzinsel / treasure island", coord.name);
- assertTrue(new Geopoint(48.859683, 9.1874).isEqualTo(coord.coords));
- assertEquals(1.0f, coord.difficulty.floatValue());
- assertEquals(5.0f, coord.terrain.floatValue());
- assertEquals(CacheSize.MICRO, coord.size);
+ assertEquals("GC1BKP3", coord.getGeocode());
+ assertEquals("Die Schatzinsel / treasure island", coord.getName());
+ assertTrue(new Geopoint(48.859683, 9.1874).isEqualTo(coord.getCoords()));
+ assertEquals(1.0f, coord.getDifficulty().floatValue());
+ assertEquals(5.0f, coord.getTerrain().floatValue());
+ assertEquals(CacheSize.MICRO, coord.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