aboutsummaryrefslogtreecommitdiffstats
path: root/tests/src
diff options
context:
space:
mode:
Diffstat (limited to 'tests/src')
-rw-r--r--tests/src/cgeo/geocaching/GeocacheTest.java8
-rw-r--r--tests/src/cgeo/geocaching/WaypointTest.java38
2 files changed, 29 insertions, 17 deletions
diff --git a/tests/src/cgeo/geocaching/GeocacheTest.java b/tests/src/cgeo/geocaching/GeocacheTest.java
index f7e4e84..5d9a31c 100644
--- a/tests/src/cgeo/geocaching/GeocacheTest.java
+++ b/tests/src/cgeo/geocaching/GeocacheTest.java
@@ -100,6 +100,11 @@ public class GeocacheTest extends CGeoTestCase {
stored.setType(CacheType.TRADITIONAL);
stored.setCoords(new Geopoint(40.0, 8.0));
stored.setDescription("Test1");
+ ArrayList<String> attributes = new ArrayList<String>(1);
+ attributes.add("TestAttribute");
+ stored.setAttributes(attributes);
+ stored.setShortDescription("Short");
+ stored.setHint("Hint");
Geocache download = new Geocache();
download.setGeocode("GC12345");
@@ -117,6 +122,9 @@ public class GeocacheTest extends CGeoTestCase {
assertEquals("Longitude not merged correctly", 9.0, download.getCoords().getLongitude(), 0.1);
assertEquals("Latitude not merged correctly", 41.0, download.getCoords().getLatitude(), 0.1);
assertEquals("Description not merged correctly", "Test2", download.getDescription());
+ assertEquals("ShortDescription not merged correctly", "", download.getShortDescription());
+ assertEquals("Attributes not merged correctly", new ArrayList<String>(0), download.getAttributes());
+ assertEquals("Hint not merged correctly", "", download.getHint());
}
public static void testMergeLivemapStored() {
diff --git a/tests/src/cgeo/geocaching/WaypointTest.java b/tests/src/cgeo/geocaching/WaypointTest.java
index dc2853a..3ddc32c 100644
--- a/tests/src/cgeo/geocaching/WaypointTest.java
+++ b/tests/src/cgeo/geocaching/WaypointTest.java
@@ -14,23 +14,27 @@ public class WaypointTest extends AndroidTestCase {
final Waypoint own = new Waypoint("own", WaypointType.OWN, true);
final Waypoint parking = new Waypoint("parking", WaypointType.PARKING, false);
- assertTrue(trailhead.compareTo(puzzle) < 0);
- assertTrue(trailhead.compareTo(stage) < 0);
- assertTrue(trailhead.compareTo(cache) < 0);
-
- assertTrue(stage.compareTo(cache) < 0);
- assertTrue(puzzle.compareTo(cache) < 0);
-
- assertTrue(trailhead.compareTo(own) < 0);
- assertTrue(puzzle.compareTo(own) < 0);
- assertTrue(stage.compareTo(own) < 0);
- assertTrue(cache.compareTo(own) < 0);
-
- assertTrue(parking.compareTo(puzzle) < 0);
- assertTrue(parking.compareTo(stage) < 0);
- assertTrue(parking.compareTo(cache) < 0);
- assertTrue(parking.compareTo(own) < 0);
- assertTrue(parking.compareTo(trailhead) < 0);
+ assertOrdered(trailhead, puzzle);
+ assertOrdered(trailhead, stage);
+ assertOrdered(trailhead, cache);
+
+ assertOrdered(stage, cache);
+ assertOrdered(puzzle, cache);
+
+ assertOrdered(trailhead, own);
+ assertOrdered(puzzle, own);
+ assertOrdered(stage, own);
+ assertOrdered(cache, own);
+
+ assertOrdered(parking, puzzle);
+ assertOrdered(parking, stage);
+ assertOrdered(parking, cache);
+ assertOrdered(parking, own);
+ assertOrdered(parking, trailhead);
+ }
+
+ private static void assertOrdered(Waypoint first, Waypoint second) {
+ assertTrue(Waypoint.WAYPOINT_COMPARATOR.compare(first, second) < 0);
}
public static void testGeocode() {