X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Ftest%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Ftext%2FSoneTextParserTest.java;h=40e812411974bd37a0db28042ac1a4e692f487b0;hp=8956ba4e2e490b6e067bf84bdba497034c8a7fa7;hb=4087be42ee49af7f216b40060a429a52409ae34a;hpb=429b99e1930f7bc4a02027b93f7a8985d6c1bc8a diff --git a/src/test/java/net/pterodactylus/sone/text/SoneTextParserTest.java b/src/test/java/net/pterodactylus/sone/text/SoneTextParserTest.java index 8956ba4..40e8124 100644 --- a/src/test/java/net/pterodactylus/sone/text/SoneTextParserTest.java +++ b/src/test/java/net/pterodactylus/sone/text/SoneTextParserTest.java @@ -145,43 +145,43 @@ public class SoneTextParserTest { @Test public void httpsLinkHasItsPathsShortened() { Iterable parts = soneTextParser.parse("https://test.test/some-long-path/file.txt", null); - assertThat("Part Text", convertText(parts), is("[https://test.test/some-long-path/file.txt|test.test/…/file.txt|test.test/…/file.txt]")); + assertThat("Part Text", convertText(parts), is("[https://test.test/some-long-path/file.txt|https://test.test/some-long-path/file.txt|test.test/…/file.txt]")); } @Test public void httpLinksHaveTheirLastSlashRemoved() { Iterable parts = soneTextParser.parse("http://test.test/test/", null); - assertThat("Part Text", convertText(parts), is("[http://test.test/test/|test.test/…|test.test/…]")); + assertThat("Part Text", convertText(parts), is("[http://test.test/test/|http://test.test/test/|test.test/…]")); } @Test public void wwwPrefixIsRemovedForHostnameWithTwoDotsAndNoPath() { Iterable parts = soneTextParser.parse("http://www.test.test", null); - assertThat("Part Text", convertText(parts), is("[http://www.test.test|test.test|test.test]")); + assertThat("Part Text", convertText(parts), is("[http://www.test.test|http://www.test.test|test.test]")); } @Test public void wwwPrefixIsRemovedForHostnameWithTwoDotsAndAPath() { Iterable parts = soneTextParser.parse("http://www.test.test/test.html", null); - assertThat("Part Text", convertText(parts), is("[http://www.test.test/test.html|test.test/test.html|test.test/test.html]")); + assertThat("Part Text", convertText(parts), is("[http://www.test.test/test.html|http://www.test.test/test.html|test.test/test.html]")); } @Test public void hostnameIsKeptIntactIfNotBeginningWithWww() { Iterable parts = soneTextParser.parse("http://test.test.test/test.html", null); - assertThat("Part Text", convertText(parts), is("[http://test.test.test/test.html|test.test.test/test.html|test.test.test/test.html]")); + assertThat("Part Text", convertText(parts), is("[http://test.test.test/test.html|http://test.test.test/test.html|test.test.test/test.html]")); } @Test public void hostnameWithOneDotButNoSlashIsKeptIntact() { Iterable parts = soneTextParser.parse("http://test.test", null); - assertThat("Part Text", convertText(parts), is("[http://test.test|test.test|test.test]")); + assertThat("Part Text", convertText(parts), is("[http://test.test|http://test.test|test.test]")); } @Test public void urlParametersAreRemovedForHttpLinks() { Iterable parts = soneTextParser.parse("http://test.test?foo=bar", null); - assertThat("Part Text", convertText(parts), is("[http://test.test?foo=bar|test.test|test.test]")); + assertThat("Part Text", convertText(parts), is("[http://test.test?foo=bar|http://test.test?foo=bar|test.test]")); } @Test @@ -269,7 +269,7 @@ public class SoneTextParserTest { @Test public void httpLinkWithoutParensEndsAtNextClosingParen() { Iterable parts = soneTextParser.parse("Some text (and a link: http://example.sone/abc) – nice!", null); - 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!")); + assertThat("Part Text", convertText(parts, PlainTextPart.class, LinkPart.class), is("Some text (and a link: [http://example.sone/abc|http://example.sone/abc|example.sone/abc]) – nice!")); } @Test @@ -281,37 +281,37 @@ public class SoneTextParserTest { @Test public void httpLinkWithOpenedAndClosedParensEndsAtNextClosingParen() { Iterable parts = soneTextParser.parse("Some text (and a link: http://example.sone/abc_(def)) – nice!", null); - assertThat("Part Text", convertText(parts, PlainTextPart.class, LinkPart.class), is("Some text (and a link: [http://example.sone/abc_(def)|example.sone/abc_(def)|example.sone/abc_(def)]) – nice!")); + assertThat("Part Text", convertText(parts, PlainTextPart.class, LinkPart.class), is("Some text (and a link: [http://example.sone/abc_(def)|http://example.sone/abc_(def)|example.sone/abc_(def)]) – nice!")); } @Test public void punctuationIsIgnoredAtEndOfLinkBeforeWhitespace() { Iterable parts = soneTextParser.parse("Some text and a link: http://example.sone/abc. Nice!", null); - 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!")); + assertThat("Part Text", convertText(parts, PlainTextPart.class, LinkPart.class), is("Some text and a link: [http://example.sone/abc|http://example.sone/abc|example.sone/abc]. Nice!")); } @Test public void multiplePunctuationCharactersAreIgnoredAtEndOfLinkBeforeWhitespace() { Iterable parts = soneTextParser.parse("Some text and a link: http://example.sone/abc... Nice!", null); - 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!")); + assertThat("Part Text", convertText(parts, PlainTextPart.class, LinkPart.class), is("Some text and a link: [http://example.sone/abc|http://example.sone/abc|example.sone/abc]... Nice!")); } @Test public void commasAreIgnoredAtEndOfLinkBeforeWhitespace() { Iterable parts = soneTextParser.parse("Some text and a link: http://example.sone/abc, nice!", null); - 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!")); + assertThat("Part Text", convertText(parts, PlainTextPart.class, LinkPart.class), is("Some text and a link: [http://example.sone/abc|http://example.sone/abc|example.sone/abc], nice!")); } @Test public void exclamationMarksAreIgnoredAtEndOfLinkBeforeWhitespace() { Iterable parts = soneTextParser.parse("A link: http://example.sone/abc!", null); - assertThat("Part Text", convertText(parts, PlainTextPart.class, LinkPart.class), is("A link: [http://example.sone/abc|example.sone/abc|example.sone/abc]!")); + assertThat("Part Text", convertText(parts, PlainTextPart.class, LinkPart.class), is("A link: [http://example.sone/abc|http://example.sone/abc|example.sone/abc]!")); } @Test public void questionMarksAreIgnoredAtEndOfLinkBeforeWhitespace() { Iterable parts = soneTextParser.parse("A link: http://example.sone/abc?", null); - assertThat("Part Text", convertText(parts, PlainTextPart.class, LinkPart.class), is("A link: [http://example.sone/abc|example.sone/abc|example.sone/abc]?")); + assertThat("Part Text", convertText(parts, PlainTextPart.class, LinkPart.class), is("A link: [http://example.sone/abc|http://example.sone/abc|example.sone/abc]?")); } @Test