aboutsummaryrefslogtreecommitdiffstats
path: root/tests/src/cgeo/geocaching/connector/oc/OCXMLTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'tests/src/cgeo/geocaching/connector/oc/OCXMLTest.java')
-rw-r--r--tests/src/cgeo/geocaching/connector/oc/OCXMLTest.java34
1 files changed, 17 insertions, 17 deletions
diff --git a/tests/src/cgeo/geocaching/connector/oc/OCXMLTest.java b/tests/src/cgeo/geocaching/connector/oc/OCXMLTest.java
index b12823a..4709565 100644
--- a/tests/src/cgeo/geocaching/connector/oc/OCXMLTest.java
+++ b/tests/src/cgeo/geocaching/connector/oc/OCXMLTest.java
@@ -5,6 +5,10 @@ import cgeo.geocaching.Geocache;
import cgeo.geocaching.Settings;
import cgeo.geocaching.enumerations.CacheType;
+import org.apache.commons.lang3.StringUtils;
+
+import android.text.Html;
+
import java.util.Collection;
public class OCXMLTest extends CGeoTestCase {
@@ -89,35 +93,31 @@ public class OCXMLTest extends CGeoTestCase {
assertNotNull(cache);
try {
assertEquals(geoCode, cache.getGeocode());
- assertEquals(description, cache.getDescription());
+ // ignore copyright as the date part will change all the time
+ assertEquals(description, removeCopyrightAndTags(cache.getDescription()));
cache.store(null);
// reload, make sure description is not duplicated
cache = OCXMLClient.getCache(geoCode);
assertNotNull(cache);
- assertEquals(description, cache.getDescription());
+ assertEquals(description, removeCopyrightAndTags(cache.getDescription()));
} finally {
deleteCacheFromDB(geoCode);
}
}
- public static void testRemoveMarkupCache() {
- final String geoCode = "OCEFBA";
- final String description = "Bei dem Cache kannst du einen kleinen Schatz bergen. Bitte lege aber einen ander Schatz in das Döschen. Achtung vor Automuggels.";
-
- Geocache cache = OCXMLClient.getCache(geoCode);
- assertNotNull(cache);
- assertEquals(description, cache.getDescription());
+ private static String removeCopyrightAndTags(String input) {
+ return Html.fromHtml(StringUtils.substringBefore(input, "&copy")).toString().trim();
}
public static void testRemoveMarkup() {
- assertEquals("", OC11XMLParser.stripMarkup(""));
- assertEquals("Test", OC11XMLParser.stripMarkup("Test"));
- assertEquals("<b>bold and others not removed</b>", OC11XMLParser.stripMarkup("<b>bold and others not removed</b>"));
- assertEquals("unnecessary paragraph", OC11XMLParser.stripMarkup("<p>unnecessary paragraph</p>"));
- assertEquals("unnecessary span", OC11XMLParser.stripMarkup("<span>unnecessary span</span>"));
- assertEquals("nested", OC11XMLParser.stripMarkup("<span><span>nested</span></span>"));
- assertEquals("mixed", OC11XMLParser.stripMarkup("<span> <p> mixed </p> </span>"));
- assertEquals("<p>not</p><p>removable</p>", OC11XMLParser.stripMarkup("<p>not</p><p>removable</p>"));
+ assertEquals("", OC11XMLParser.stripEmptyText(""));
+ assertEquals("Test", OC11XMLParser.stripEmptyText("Test"));
+ assertEquals("<b>bold and others not removed</b>", OC11XMLParser.stripEmptyText("<b>bold and others not removed</b>"));
+ assertEquals("unnecessary paragraph", OC11XMLParser.stripEmptyText("<p>unnecessary paragraph</p>"));
+ assertEquals("unnecessary span", OC11XMLParser.stripEmptyText("<span>unnecessary span</span>"));
+ assertEquals("nested", OC11XMLParser.stripEmptyText("<span><span>nested</span></span>"));
+ assertEquals("mixed", OC11XMLParser.stripEmptyText("<span> <p> mixed </p> </span>"));
+ assertEquals("<p>not</p><p>removable</p>", OC11XMLParser.stripEmptyText("<p>not</p><p>removable</p>"));
}
}