aboutsummaryrefslogtreecommitdiffstats
path: root/tests/src
diff options
context:
space:
mode:
authorBananeweizen <bananeweizen@gmx.de>2014-01-12 08:36:10 +0100
committerBananeweizen <bananeweizen@gmx.de>2014-01-12 08:36:10 +0100
commitf1f38d264084d5044998abb5d7587e147afdf769 (patch)
tree1fb006e9b1bf3ca2b95820c1f13165cf1aaf2cab /tests/src
parent1e663778359c192d674e2ab9f77480bdba609be5 (diff)
downloadcgeo-f1f38d264084d5044998abb5d7587e147afdf769.zip
cgeo-f1f38d264084d5044998abb5d7587e147afdf769.tar.gz
cgeo-f1f38d264084d5044998abb5d7587e147afdf769.tar.bz2
refactoring: remove unused code
Diffstat (limited to 'tests/src')
-rw-r--r--tests/src/cgeo/geocaching/CgeoApplicationTest.java2
-rw-r--r--tests/src/cgeo/geocaching/connector/gc/GCParserTest.java5
-rw-r--r--tests/src/cgeo/geocaching/geopoint/GeoPointParserTest.java16
-rw-r--r--tests/src/cgeo/geocaching/geopoint/ViewportTest.java2
-rw-r--r--tests/src/cgeo/geocaching/sorting/DistanceComparatorTest.java2
5 files changed, 17 insertions, 10 deletions
diff --git a/tests/src/cgeo/geocaching/CgeoApplicationTest.java b/tests/src/cgeo/geocaching/CgeoApplicationTest.java
index edf7862..cd80889 100644
--- a/tests/src/cgeo/geocaching/CgeoApplicationTest.java
+++ b/tests/src/cgeo/geocaching/CgeoApplicationTest.java
@@ -366,7 +366,7 @@ public class CgeoApplicationTest extends CGeoTestCase {
final Geocache cacheFromViewport = DataStore.loadCache(cache.getGeocode(), LoadFlags.LOAD_CACHE_OR_DB);
Log.d("cgeoApplicationTest.testSearchByViewportNotLoggedIn: Coords expected = " + cache.getCoords());
Log.d("cgeoApplicationTest.testSearchByViewportNotLoggedIn: Coords actual = " + cacheFromViewport.getCoords());
- assertFalse(cache.getCoords().isEqualTo(cacheFromViewport.getCoords(), 1e-3));
+ assertFalse(cache.getCoords().distanceTo(cacheFromViewport.getCoords()) <= 1e-3);
// depending on the chosen strategy the coords can be reliable or not
assertEquals(testStrategy == Strategy.DETAILED, cacheFromViewport.isReliableLatLon());
diff --git a/tests/src/cgeo/geocaching/connector/gc/GCParserTest.java b/tests/src/cgeo/geocaching/connector/gc/GCParserTest.java
index 53c393b..1509563 100644
--- a/tests/src/cgeo/geocaching/connector/gc/GCParserTest.java
+++ b/tests/src/cgeo/geocaching/connector/gc/GCParserTest.java
@@ -178,9 +178,10 @@ public class GCParserTest extends AbstractResourceInstrumentationTestCase {
cache.setPersonalNote(note);
cache.setWaypoints(new ArrayList<Waypoint>(), false);
cache.parseWaypointsFromNote();
- assertEquals(expected.length, cache.getWaypoints().size());
+ final List<Waypoint> waypoints = cache.getWaypoints();
+ assertEquals(expected.length, waypoints.size());
for (int i = 0; i < expected.length; i++) {
- assertTrue(expected[i].equals(cache.getWaypoint(i).getCoords()));
+ assertTrue(expected[i].equals(waypoints.get(i).getCoords()));
}
}
diff --git a/tests/src/cgeo/geocaching/geopoint/GeoPointParserTest.java b/tests/src/cgeo/geocaching/geopoint/GeoPointParserTest.java
index 1de2e26..28dbe77 100644
--- a/tests/src/cgeo/geocaching/geopoint/GeoPointParserTest.java
+++ b/tests/src/cgeo/geocaching/geopoint/GeoPointParserTest.java
@@ -19,7 +19,13 @@ public class GeoPointParserTest extends AndroidTestCase {
public static void testFullCoordinates() {
final Geopoint goal = new Geopoint(refLatitude, refLongitude);
- assertTrue(goal.isEqualTo(GeopointParser.parse("N 49° 56.031 | E 8° 38.564"), 1e-6));
+ assertEquals(goal, GeopointParser.parse("N 49° 56.031 | E 8° 38.564"), 1e-6);
+ }
+
+ private static void assertEquals(final Geopoint expected, Geopoint actual, double tolerance) {
+ assertNotNull(expected);
+ assertNotNull(actual);
+ assertTrue(expected.distanceTo(actual) <= tolerance);
}
public static void testCoordinateMissingPart() {
@@ -48,18 +54,18 @@ public class GeoPointParserTest extends AndroidTestCase {
public static void testVariousFormats() {
final Geopoint goal1 = GeopointParser.parse("N 49° 43' 57\" | E 2 12' 35");
final Geopoint goal2 = GeopointParser.parse("N 49 43.95 E2°12.5833333333");
- assertTrue(goal1.isEqualTo(goal2, 1e-6));
+ assertEquals(goal1, goal2, 1e-6);
}
public static void testParseOurOwnSeparator() {
final Geopoint separator = GeopointParser.parse("N 49° 43' 57\"" + Formatter.SEPARATOR + "E 2 12' 35");
final Geopoint noSeparator = GeopointParser.parse("N 49 43.95 E2°12.5833333333");
- assertTrue(separator.isEqualTo(noSeparator, 1e-6));
+ assertEquals(separator, noSeparator, 1e-6);
}
public static void testInSentence() {
final Geopoint p1 = GeopointParser.parse("Station3: N51 21.523 / E07 02.680");
- final Geopoint p2 = GeopointParser.parse("N51 21.523", "E07 02.680");
+ final Geopoint p2 = GeopointParser.parse("N51 21.523 E07 02.680");
assertNotNull(p1);
assertNotNull(p2);
assertEquals(p1, p2);
@@ -106,6 +112,6 @@ public class GeoPointParserTest extends AndroidTestCase {
}
public static void testEquatorMeridian() {
- assertEquals(new Geopoint(0, 0), GeopointParser.parse("00° 00.000 00° 00.000"));
+ assertEquals(Geopoint.ZERO, GeopointParser.parse("00° 00.000 00° 00.000"));
}
}
diff --git a/tests/src/cgeo/geocaching/geopoint/ViewportTest.java b/tests/src/cgeo/geocaching/geopoint/ViewportTest.java
index da7d58f..11f78ad 100644
--- a/tests/src/cgeo/geocaching/geopoint/ViewportTest.java
+++ b/tests/src/cgeo/geocaching/geopoint/ViewportTest.java
@@ -52,7 +52,7 @@ public class ViewportTest extends AndroidTestCase {
public static void testInViewport() {
assertFalse(vpRef.contains(new Geopoint(-2.0, -2.0)));
assertFalse(vpRef.contains(new Geopoint(4.0, 4.0)));
- assertTrue(vpRef.contains(new Geopoint(0.0, 0.0)));
+ assertTrue(vpRef.contains(Geopoint.ZERO));
assertTrue(vpRef.contains(new Geopoint(-1.0, -2.0)));
assertTrue(vpRef.contains(new Geopoint(3.0, 4.0)));
}
diff --git a/tests/src/cgeo/geocaching/sorting/DistanceComparatorTest.java b/tests/src/cgeo/geocaching/sorting/DistanceComparatorTest.java
index 2db3f59..0cfee49 100644
--- a/tests/src/cgeo/geocaching/sorting/DistanceComparatorTest.java
+++ b/tests/src/cgeo/geocaching/sorting/DistanceComparatorTest.java
@@ -20,7 +20,7 @@ public class DistanceComparatorTest extends AndroidTestCase {
}
caches.add(cache);
}
- Collections.sort(caches, new DistanceComparator(new Geopoint(0, 0), caches));
+ Collections.sort(caches, new DistanceComparator(Geopoint.ZERO, caches));
}
}