aboutsummaryrefslogtreecommitdiffstats
path: root/tests/src/cgeo/geocaching/connector/trackable/SwaggieParserTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'tests/src/cgeo/geocaching/connector/trackable/SwaggieParserTest.java')
-rw-r--r--tests/src/cgeo/geocaching/connector/trackable/SwaggieParserTest.java34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/src/cgeo/geocaching/connector/trackable/SwaggieParserTest.java b/tests/src/cgeo/geocaching/connector/trackable/SwaggieParserTest.java
new file mode 100644
index 0000000..2661fb3
--- /dev/null
+++ b/tests/src/cgeo/geocaching/connector/trackable/SwaggieParserTest.java
@@ -0,0 +1,34 @@
+package cgeo.geocaching.connector.trackable;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import cgeo.geocaching.Trackable;
+import cgeo.geocaching.connector.ConnectorFactory;
+import cgeo.geocaching.network.Network;
+
+import junit.framework.TestCase;
+
+public class SwaggieParserTest extends TestCase {
+
+ public static void testParse() {
+ final Trackable trackableIn = new Trackable();
+ trackableIn.setGeocode("SW0017");
+
+ final String trackableUrl = ConnectorFactory.getTrackableConnector(trackableIn.getGeocode()).getUrl(trackableIn);
+ assertThat(trackableUrl).isNotNull();
+
+ final String page = Network.getResponseData(Network.getRequest(trackableUrl));
+ assertThat(page).isNotNull();
+
+ assert page != null;
+ final Trackable trackable = SwaggieParser.parse(page);
+ assertThat(trackable).isNotNull();
+ assert trackable != null;
+
+ assertThat(trackable.getName()).isEqualTo("Law and Order 1");
+ assertThat(trackable.getGeocode()).isEqualTo("SW0017");
+ assertThat(trackable.getDetails()).isEqualTo("A mini CD that may or may not contain a DivX .AVI of the Law and Order: CSI episode that features geocaching as part of the storyline.");
+ assertThat(trackable.getType()).isEqualTo("Swaggie");
+ assertThat(trackable.getOwner()).isEqualTo("Bear_Left");
+ }
+}