Fix indentation
[Sone.git] / src / test / java / net / pterodactylus / sone / text / SoneTextParserTest.java
index 6483171..2a33b9e 100644 (file)
@@ -116,7 +116,7 @@ public class SoneTextParserTest {
 
        @Test
        public void nameOfFreenetLinkDoesNotContainUrlParameters() {
-           Iterable<Part> parts = soneTextParser.parse("KSK@gpl.txt?max-size=12345", null);
+               Iterable<Part> parts = soneTextParser.parse("KSK@gpl.txt?max-size=12345", null);
                assertThat("Part Text", convertText(parts), is("[KSK@gpl.txt?max-size=12345|gpl.txt|gpl.txt]"));
        }
 
@@ -152,7 +152,7 @@ public class SoneTextParserTest {
 
        @Test
        public void httpLinksHaveTheirLastSlashRemoved() {
-           Iterable<Part> parts = soneTextParser.parse("http://test.test/test/", null);
+               Iterable<Part> parts = soneTextParser.parse("http://test.test/test/", null);
                assertThat("Part Text", convertText(parts), is("[http://test.test/test/|test.test/…|test.test/…]"));
        }
 
@@ -317,6 +317,22 @@ public class SoneTextParserTest {
                assertThat("Part Text", convertText(parts, PlainTextPart.class, LinkPart.class), is("Some text and a link: [http://example.sone/abc|example.sone/abc|example.sone/abc], nice!"));
        }
 
+       @Test
+       public void exclamationMarksAreIgnoredAtEndOfLinkBeforeWhitespace() {
+               SoneTextParser soneTextParser = new SoneTextParser(null, null);
+               Iterable<Part> parts = soneTextParser.parse("A link: http://example.sone/abc!", null);
+               assertThat("Parts", parts, notNullValue());
+               assertThat("Part Text", convertText(parts, PlainTextPart.class, LinkPart.class), is("A link: [http://example.sone/abc|example.sone/abc|example.sone/abc]!"));
+       }
+
+       @Test
+       public void questionMarksAreIgnoredAtEndOfLinkBeforeWhitespace() {
+               SoneTextParser soneTextParser = new SoneTextParser(null, null);
+               Iterable<Part> parts = soneTextParser.parse("A link: http://example.sone/abc?", null);
+               assertThat("Parts", parts, notNullValue());
+               assertThat("Part Text", convertText(parts, PlainTextPart.class, LinkPart.class), is("A link: [http://example.sone/abc|example.sone/abc|example.sone/abc]?"));
+       }
+
        /**
         * Converts all given {@link Part}s into a string, validating that the
         * part’s classes match only the expected classes.