blob: cb356458b19e8615e628fe8e286b45bb4fd9dae8 (
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
|
package cgeo.geocaching.connector;
import cgeo.geocaching.test.AbstractResourceInstrumentationTestCase;
import cgeo.geocaching.test.mock.GC1ZXX2;
public class ConnectorFactoryTest extends AbstractResourceInstrumentationTestCase {
public static void testGetConnectors() {
IConnector[] connectors = ConnectorFactory.getConnectors();
assertNotNull(connectors);
assertTrue(connectors.length > 0); // unknown connector must exist
}
public static void testCanHandle() {
assertFalse(ConnectorFactory.canHandle(""));
assertTrue(ConnectorFactory.canHandle("GC12345"));
assertTrue(ConnectorFactory.canHandle("some string")); // using unknown connector
assertFalse(ConnectorFactory.canHandle("[/start with special char"));
}
public static void testGetConnectorCgCache() {
assertEquals(GCConnector.getInstance(), ConnectorFactory.getConnector(new GC1ZXX2()));
}
public static void testGetConnectorString() {
IConnector connector = ConnectorFactory.getConnector("GC12345");
assertNotNull(connector);
assertEquals(GCConnector.getInstance().getName(), connector.getName());
}
}
|