1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
package cgeo.geocaching;
import cgeo.geocaching.enumerations.WaypointType;
import android.test.AndroidTestCase;
public class WaypointTest extends AndroidTestCase {
public static void testOrder() {
final Waypoint cache = new Waypoint("Final", WaypointType.FINAL, false);
final Waypoint trailhead = new Waypoint("Trail head", WaypointType.TRAILHEAD, false);
final Waypoint stage = new Waypoint("stage", WaypointType.STAGE, false);
final Waypoint puzzle = new Waypoint("puzzle", WaypointType.PUZZLE, false);
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);
}
public static void testGeocode() {
final Waypoint waypoint = new Waypoint("Test waypoint", WaypointType.PARKING, false);
waypoint.setGeocode("p1");
assertEquals("P1", waypoint.getGeocode());
}
}
|