aboutsummaryrefslogtreecommitdiffstats
path: root/tests/src/cgeo/geocaching/ui/FormatterTest.java
blob: 8f48abba3e5d2e6c78925d169d6fe726c7df94bc (plain)
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
package cgeo.geocaching.ui;

import cgeo.geocaching.R;
import cgeo.geocaching.cgWaypoint;
import cgeo.geocaching.cgeoapplication;
import cgeo.geocaching.enumerations.WaypointType;

import android.test.AndroidTestCase;

public class FormatterTest extends AndroidTestCase {

    public static void testParkingWaypoint() {
        assertFormatting(new cgWaypoint("you can park here", WaypointType.PARKING, false), WaypointType.PARKING.getL10n());
    }

    public static void testOriginalWaypoint() {
        assertFormatting(new cgWaypoint("an original", WaypointType.ORIGINAL, false), WaypointType.ORIGINAL.getL10n());
    }

    public static void testOwnWaypoint() {
        cgWaypoint own = new cgWaypoint("my own", WaypointType.OWN, true);
        own.setPrefix(cgWaypoint.PREFIX_OWN);
        assertFormatting(own, cgeoapplication.getInstance().getString(R.string.waypoint_custom));
    }

    private static void assertFormatting(cgWaypoint waypoint, String expected) {
        assertEquals(expected, Formatter.formatWaypointInfo(waypoint));
    }

}