X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Ftest%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Ftext%2FSoneTextParserTest.java;h=8d83c95b8ab52b90fa69eb7193d8984d204efce5;hp=200a773b54d2a37cca509f3e39371ea7307b3f24;hb=505c771415cd5c6f71c24e6c2b837d6e2f0c3a78;hpb=9ea06b200fc39b0dbb07734df1c74599d6a93bd2 diff --git a/src/test/java/net/pterodactylus/sone/text/SoneTextParserTest.java b/src/test/java/net/pterodactylus/sone/text/SoneTextParserTest.java index 200a773..8d83c95 100644 --- a/src/test/java/net/pterodactylus/sone/text/SoneTextParserTest.java +++ b/src/test/java/net/pterodactylus/sone/text/SoneTextParserTest.java @@ -108,6 +108,21 @@ public class SoneTextParserTest { assertThat("Part Text", "Some text. Empty link: http:// – nice!", is(convertText(parts, PlainTextPart.class))); } + @Test + public void httpLinkWithoutParensEndsAtNextClosingParen() { + SoneTextParser soneTextParser = new SoneTextParser(null, null); + Iterable parts = soneTextParser.parse("Some text (and a link: http://example.sone/abc) – nice!", null); + assertThat("Parts", parts, notNullValue()); + assertThat("Part Text", "Some text (and a link: [http://example.sone/abc|example.sone/abc|example.sone/abc]) – nice!", is(convertText(parts, PlainTextPart.class, LinkPart.class))); + } + + @Test + public void httpLinkWithOpenedAndClosedParensEndsAtNextClosingParen() { + SoneTextParser soneTextParser = new SoneTextParser(null, null); + Iterable parts = soneTextParser.parse("Some text (and a link: http://example.sone/abc_(def)) – nice!", null); + assertThat("Parts", parts, notNullValue()); + assertThat("Part Text", "Some text (and a link: [http://example.sone/abc_(def)|example.sone/abc_(def)|example.sone/abc_(def)]) – nice!", is(convertText(parts, PlainTextPart.class, LinkPart.class))); + } /** * Converts all given {@link Part}s into a string, validating that the