aboutsummaryrefslogtreecommitdiffstats
path: root/tests/src/cgeo/geocaching/TrackableTest.java
blob: 7d3fd5ce492227db02d8dbda06ad7d2ccae61d4d (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
31
32
33
34
35
36
37
38
39
package cgeo.geocaching;

import android.test.AndroidTestCase;

public class TrackableTest extends AndroidTestCase {

    public static void testGetGeocode() {
        final Trackable trackable = createTrackable("tb1234");
        assertEquals("TB1234", trackable.getGeocode());
    }

    public static void testSetLogsNull() {
        final Trackable trackable = new Trackable();
        trackable.setLogs(null);
        assertNotNull("Trackable logs must not be null!", trackable.getLogs());
    }

    public static void testTrackableUrl() {
        final Trackable trackable = createTrackable("TB1234");
        assertEquals("http://www.geocaching.com//track/details.aspx?tracker=TB1234", trackable.getUrl());
    }

    public static void testGeokretUrl() {
        Trackable geokret = createTrackable("GK82A2");
        assertEquals("http://geokrety.org/konkret.php?id=33442", geokret.getUrl());
    }

    public static void testLoggable() {
        assertTrue(createTrackable("TB1234").isLoggable());
        assertFalse(createTrackable("GK1234").isLoggable());
    }

    private static Trackable createTrackable(String geocode) {
        final Trackable trackable = new Trackable();
        trackable.setGeocode(geocode);
        return trackable;
    }

}