aboutsummaryrefslogtreecommitdiffstats
path: root/tests/src/cgeo/geocaching/geopoint
diff options
context:
space:
mode:
Diffstat (limited to 'tests/src/cgeo/geocaching/geopoint')
-rw-r--r--tests/src/cgeo/geocaching/geopoint/GeoPointFormatterTest.java4
-rw-r--r--tests/src/cgeo/geocaching/geopoint/GeoPointParserTest.java2
-rw-r--r--tests/src/cgeo/geocaching/geopoint/UnitsTest.java12
-rw-r--r--tests/src/cgeo/geocaching/geopoint/ViewportTest.java4
4 files changed, 12 insertions, 10 deletions
diff --git a/tests/src/cgeo/geocaching/geopoint/GeoPointFormatterTest.java b/tests/src/cgeo/geocaching/geopoint/GeoPointFormatterTest.java
index 4b25247..2816664 100644
--- a/tests/src/cgeo/geocaching/geopoint/GeoPointFormatterTest.java
+++ b/tests/src/cgeo/geocaching/geopoint/GeoPointFormatterTest.java
@@ -2,7 +2,7 @@ package cgeo.geocaching.geopoint;
import static org.assertj.core.api.Assertions.assertThat;
-import cgeo.geocaching.ui.Formatter;
+import cgeo.geocaching.utils.Formatter;
import android.test.AndroidTestCase;
@@ -12,7 +12,7 @@ public class GeoPointFormatterTest extends AndroidTestCase {
// From issue #2624: coordinate is wrong near to a confluence point
final Geopoint point = new Geopoint(49.9999999999999, 5.0);
final String format = GeopointFormatter.format(GeopointFormatter.Format.LAT_LON_DECDEGREE_COMMA, point);
- assertEquals("50.000000,5.000000", format);
+ assertThat(format).isEqualTo("50.000000,5.000000");
final String formatMinute = GeopointFormatter.format(GeopointFormatter.Format.LAT_LON_DECMINUTE_RAW, point);
assertThat(formatMinute).isEqualTo("N 50° 00.000 E 005° 00.000");
final String formatSecond = GeopointFormatter.format(GeopointFormatter.Format.LAT_LON_DECSECOND, point).replaceAll(",", ".");
diff --git a/tests/src/cgeo/geocaching/geopoint/GeoPointParserTest.java b/tests/src/cgeo/geocaching/geopoint/GeoPointParserTest.java
index 3e5667b..f8a3bb2 100644
--- a/tests/src/cgeo/geocaching/geopoint/GeoPointParserTest.java
+++ b/tests/src/cgeo/geocaching/geopoint/GeoPointParserTest.java
@@ -2,7 +2,7 @@ package cgeo.geocaching.geopoint;
import static org.assertj.core.api.Assertions.assertThat;
-import cgeo.geocaching.ui.Formatter;
+import cgeo.geocaching.utils.Formatter;
import android.test.AndroidTestCase;
diff --git a/tests/src/cgeo/geocaching/geopoint/UnitsTest.java b/tests/src/cgeo/geocaching/geopoint/UnitsTest.java
index acc964a..f208984 100644
--- a/tests/src/cgeo/geocaching/geopoint/UnitsTest.java
+++ b/tests/src/cgeo/geocaching/geopoint/UnitsTest.java
@@ -51,13 +51,13 @@ public class UnitsTest extends CGeoTestCase {
TestSettings.setUseImperialUnits(false);
assertSpeed("123 km/h", 122.782f);
assertSpeed("123 km/h", 123.456f);
- assertSpeed("12.3 km/h", 12.3456f);
- assertSpeed("1.23 km/h", 1.23456f);
- assertSpeed("123 m/h", 0.123456f);
+ assertSpeed("12 km/h", 12.3456f);
+ assertSpeed("1 km/h", 1.23456f);
+ assertSpeed("0 km/h", 0.123456f);
TestSettings.setUseImperialUnits(true);
- assertSpeed("76.7 mph", 123.456f);
- assertSpeed("7.67 mph", 12.3456f);
- assertSpeed("0.77 mph", 1.23456f);
+ assertSpeed("77 mph", 123.456f);
+ assertSpeed("8 mph", 12.3456f);
+ assertSpeed("1 mph", 1.23456f);
} finally {
TestSettings.setUseImperialUnits(savedImperial);
}
diff --git a/tests/src/cgeo/geocaching/geopoint/ViewportTest.java b/tests/src/cgeo/geocaching/geopoint/ViewportTest.java
index ab59e79..ace0356 100644
--- a/tests/src/cgeo/geocaching/geopoint/ViewportTest.java
+++ b/tests/src/cgeo/geocaching/geopoint/ViewportTest.java
@@ -6,6 +6,7 @@ import cgeo.geocaching.ICoordinates;
import org.eclipse.jdt.annotation.NonNull;
+import android.annotation.SuppressLint;
import android.test.AndroidTestCase;
import java.util.Collections;
@@ -59,6 +60,7 @@ public class ViewportTest extends AndroidTestCase {
assertThat(vpRef.contains(new Geopoint(3.0, 4.0))).isTrue();
}
+ @SuppressLint("DefaultLocale")
public static void testSqlWhere() {
assertThat(vpRef.sqlWhere(null).toString()).isEqualTo("latitude >= -1.0 and latitude <= 3.0 and longitude >= -2.0 and longitude <= 4.0");
assertThat(vpRef.sqlWhere("t").toString()).isEqualTo("t.latitude >= -1.0 and t.latitude <= 3.0 and t.longitude >= -2.0 and t.longitude <= 4.0");
@@ -66,7 +68,7 @@ public class ViewportTest extends AndroidTestCase {
try {
current = Locale.getDefault();
Locale.setDefault(Locale.FRENCH);
- assertEquals("1,0", String.format("%.2g", 1.0d)); // Control that we are in a locale with commma separator
+ assertThat(String.format("%.2g", 1.0d)).isEqualTo("1,0"); // Control that we are in a locale with comma separator
assertThat(vpRef.sqlWhere("t").toString()).isEqualTo("t.latitude >= -1.0 and t.latitude <= 3.0 and t.longitude >= -2.0 and t.longitude <= 4.0");
} finally {
Locale.setDefault(current);