package cgeo.geocaching.connector;

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

public class WaymarkingConnectorTest extends TestCase {

    public static void testGetGeocodeFromUrl() {
        assertThat(ConnectorFactory.getGeocodeFromURL("http://coord.info/WM1234")).isEqualTo("WM1234");
        assertThat(ConnectorFactory.getGeocodeFromURL("http://www.waymarking.com/waymarks/WMNCDT_American_Legion_Flagpole_1983_University_of_Oregon")).isEqualTo("WMNCDT");

        final IConnector wmConnector = ConnectorFactory.getConnector("WM1234");
        assertThat(wmConnector).isNotNull();

        assertThat(wmConnector.getGeocodeFromUrl("http://coord.info/WM1234")).isEqualTo("WM1234");
        assertThat(wmConnector.getGeocodeFromUrl("http://www.waymarking.com/waymarks/WMNCDT_American_Legion_Flagpole_1983_University_of_Oregon")).isEqualTo("WMNCDT");

        assertThat(wmConnector.getGeocodeFromUrl("http://coord.info/GC12ABC")).isNull();
        assertThat(wmConnector.getGeocodeFromUrl("http://coord.info/TB1234")).isNull();
    }
}

@@ -1079,11 +1079,310 @@
 );%0A    %7D
+%0A%0A    public static void testCanHandle() %7B%0A        final IConnector wmConnector = ConnectorFactory.getConnector(%22WM1234%22);%0A        assertThat(wmConnector).isNotNull();%0A%0A        assertThat(wmConnector.canHandle(%22WM1234%22)).isTrue();%0A        assertThat(wmConnector.canHandle(%22GC1234%22)).isFalse();%0A    %7D
 %0A%7D%0A

add tests for waymarking