From 8801cfcf6ab3848f11bbd5f458cb252366035d8b Mon Sep 17 00:00:00 2001 From: Bananeweizen Date: Sun, 20 Jul 2014 07:34:33 +0200 Subject: refactoring: reduce package cycles --- tests/src/cgeo/geocaching/utils/FormatterTest.java | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 tests/src/cgeo/geocaching/utils/FormatterTest.java (limited to 'tests/src/cgeo/geocaching/utils/FormatterTest.java') diff --git a/tests/src/cgeo/geocaching/utils/FormatterTest.java b/tests/src/cgeo/geocaching/utils/FormatterTest.java new file mode 100644 index 0000000..c91445d --- /dev/null +++ b/tests/src/cgeo/geocaching/utils/FormatterTest.java @@ -0,0 +1,33 @@ +package cgeo.geocaching.utils; + +import static org.assertj.core.api.Assertions.assertThat; + +import cgeo.geocaching.CgeoApplication; +import cgeo.geocaching.R; +import cgeo.geocaching.Waypoint; +import cgeo.geocaching.enumerations.WaypointType; +import cgeo.geocaching.utils.Formatter; + +import android.test.AndroidTestCase; + +public class FormatterTest extends AndroidTestCase { + + public static void testParkingWaypoint() { + assertFormatting(new Waypoint("you can park here", WaypointType.PARKING, false), WaypointType.PARKING.getL10n()); + } + + public static void testOriginalWaypoint() { + assertFormatting(new Waypoint("an original", WaypointType.ORIGINAL, false), WaypointType.ORIGINAL.getL10n()); + } + + public static void testOwnWaypoint() { + final Waypoint own = new Waypoint("my own", WaypointType.OWN, true); + own.setPrefix(Waypoint.PREFIX_OWN); + assertFormatting(own, CgeoApplication.getInstance().getString(R.string.waypoint_custom)); + } + + private static void assertFormatting(Waypoint waypoint, String expected) { + assertThat(Formatter.formatWaypointInfo(waypoint)).isEqualTo(expected); + } + +} -- cgit v1.1