Remove useless local variables
[Sone.git] / src / test / java / net / pterodactylus / sone / text / SoneTextParserTest.java
index 6483171..b0fe86f 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/…]"));
        }
 
@@ -296,7 +296,6 @@ public class SoneTextParserTest {
 
        @Test
        public void punctuationIsIgnoredAtEndOfLinkBeforeWhitespace() {
-               SoneTextParser soneTextParser = new SoneTextParser(null, null);
                Iterable<Part> parts = soneTextParser.parse("Some text and a link: http://example.sone/abc. Nice!", null);
                assertThat("Parts", parts, notNullValue());
                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!"));
@@ -311,12 +310,25 @@ public class SoneTextParserTest {
 
        @Test
        public void commasAreIgnoredAtEndOfLinkBeforeWhitespace() {
-               SoneTextParser soneTextParser = new SoneTextParser(null, null);
                Iterable<Part> parts = soneTextParser.parse("Some text and a link: http://example.sone/abc, nice!", null);
                assertThat("Parts", parts, notNullValue());
                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() {
+               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() {
+               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.