diff options
Diffstat (limited to 'tests/src/cgeo/geocaching/utils/CheckerUtilsTest.java')
-rw-r--r-- | tests/src/cgeo/geocaching/utils/CheckerUtilsTest.java | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/src/cgeo/geocaching/utils/CheckerUtilsTest.java b/tests/src/cgeo/geocaching/utils/CheckerUtilsTest.java new file mode 100644 index 0000000..fa7c7e7 --- /dev/null +++ b/tests/src/cgeo/geocaching/utils/CheckerUtilsTest.java @@ -0,0 +1,25 @@ +package cgeo.geocaching.utils; + +import static org.assertj.core.api.Assertions.assertThat; + +import cgeo.geocaching.Geocache; + +import junit.framework.TestCase; + +public class CheckerUtilsTest extends TestCase { + + public static void testGetCheckerUrl() throws Exception { + assertUrl("<p style=\"text-align:center;\"><a href=\"http://geocheck.org/geo_inputchkcoord.php?gid=618932716cc7e68-c4bb-4f41-8bb1-3e0a3e374a1f\" target=\"_blank\"><img", "http://geocheck.org/geo_inputchkcoord.php?gid=618932716cc7e68-c4bb-4f41-8bb1-3e0a3e374a1f"); + assertUrl("<p style=\"text-align:center;\"><a href=\"http://google.com/geo_inputchkcoord.php?gid=618932716cc7e68-c4bb-4f41-8bb1-3e0a3e374a1f\" target=\"_blank\"><img", null); + assertUrl("http://www.certitudes.org/certitude?wp=GC5MVX7", "http://www.certitudes.org/certitude?wp=GC5MVX7"); + assertUrl("http://geochecker.com/index.php?code=e001928e3c2682ec2bae0f24b9d02cfb&action=check&wp=474350573454&name=47656f636865636b6572205465737420666f72204e33382030302e303030205737362030302e303030", "http://geochecker.com/index.php?code=e001928e3c2682ec2bae0f24b9d02cfb&action=check&wp=474350573454&name=47656f636865636b6572205465737420666f72204e33382030302e303030205737362030302e303030"); + assertUrl("<p>Haarige Aussichten gibt es <a href=\"http://www.geochecker.com/index.php?code=cd52752a8649c5e385a624b5341176f9&action=check&wp=4743314a43384b&name=4b61747a656e&language=German\">hier</a>.</p></span>", "http://www.geochecker.com/index.php?code=cd52752a8649c5e385a624b5341176f9&action=check&wp=4743314a43384b&name=4b61747a656e&language=German"); + } + + private static void assertUrl(final String description, final String expected) { + final Geocache geocache = new Geocache(); + geocache.setDescription(description); + assertThat(CheckerUtils.getCheckerUrl(geocache)).isEqualTo(expected); + } + +} |