From: David ‘Bombe’ Roden Date: Fri, 21 Dec 2012 06:53:17 +0000 (+0100) Subject: Add test for empty link bug. X-Git-Tag: 0.8.5^2~6 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=66b03d16a393c9f02090245ea963d45ce0b4cf79;p=Sone.git Add test for empty link bug. --- diff --git a/src/test/java/net/pterodactylus/sone/text/SoneTextParserTest.java b/src/test/java/net/pterodactylus/sone/text/SoneTextParserTest.java index b00fcfe..e1857a0 100644 --- a/src/test/java/net/pterodactylus/sone/text/SoneTextParserTest.java +++ b/src/test/java/net/pterodactylus/sone/text/SoneTextParserTest.java @@ -19,6 +19,7 @@ package net.pterodactylus.sone.text; import java.io.IOException; import java.io.StringReader; +import java.util.Arrays; import junit.framework.TestCase; import net.pterodactylus.sone.core.SoneProvider; @@ -106,6 +107,24 @@ public class SoneTextParserTest extends TestCase { assertEquals("Part Text", "Some text.\n\nLink to [Sone|DAxKQzS48mtaQc7sUVHIgx3fnWZPQBz0EueBreUVWrU] and stuff.", convertText(parts, PlainTextPart.class, SonePart.class)); } + /** + * Test for a bug discovered in Sone 0.8.4 where a plain “http://” would be + * parsed into a link. + * + * @throws IOException + * if an I/O error occurs + */ + @SuppressWarnings({ "synthetic-access", "static-method" }) + public void testEmpyHttpLinks() throws IOException { + SoneTextParser soneTextParser = new SoneTextParser(new TestSoneProvider(), null); + Iterable parts; + + /* check empty http links. */ + parts = soneTextParser.parse(null, new StringReader("Some text. Empty link: http:// – nice!")); + assertNotNull("Parts", parts); + assertEquals("Part Text", "Some text. Empty link: http:// – nice!", convertText(parts, PlainTextPart.class)); + } + // // PRIVATE METHODS //