aboutsummaryrefslogtreecommitdiffstats
path: root/tests/src/cgeo/geocaching/connector/ox/OXConnectorTest.java
blob: 11f2d66be188914fa45e7285560ad05c533c99c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package cgeo.geocaching.connector.ox;

import static org.assertj.core.api.Assertions.assertThat;
import junit.framework.TestCase;

public class OXConnectorTest extends TestCase {

    public static void testCanHandle() {
        // http://www.opencaching.com/api_doc/concepts/oxcodes.html
        final OXConnector oxConnector = new OXConnector();
        assertThat(oxConnector.canHandle("OXZZZZZ")).isTrue();
        assertThat(oxConnector.canHandle("OX1")).isTrue();
        assertThat(oxConnector.canHandle("GCABCDE")).isFalse();
        assertThat(oxConnector.canHandle("OX_")).isFalse();
    }

    public static void testGetGeocodeFromUrl() {
        final OXConnector connector = new OXConnector();
        assertThat(connector.getGeocodeFromUrl("http://www.opencaching.com/de/#!geocache/OX1R421")).isEqualTo("OX1R421");
        assertThat(connector.getGeocodeFromUrl("http://www.opencaching.com/#!geocache/OX1R421")).isEqualTo("OX1R421");
    }

}