Skip to content

Commit 120593f

Browse files
committed
incorporating inspection comments
1 parent 6c799fd commit 120593f

File tree

2 files changed

+23
-9
lines changed

2 files changed

+23
-9
lines changed

src/test/java/org/nibor/autolink/AutolinkUrlTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ protected LinkExtractor getLinkExtractor() {
195195
return linkExtractor;
196196
}
197197

198-
private void assertLinked(String input, String expected) {
198+
protected void assertLinked(String input, String expected) {
199199
super.assertLinked(input, expected, LinkType.URL);
200200
}
201201
}

src/test/java/org/nibor/autolink/AutolinkWwwUrlTest.java

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@
1010
import org.junit.runners.Parameterized.Parameters;
1111

1212
@RunWith(Parameterized.class)
13-
public class AutolinkWwwUrlTest extends AutolinkUrlTest {
13+
public class AutolinkWwwUrlTest extends AutolinkTestCase {
1414

1515
@Parameters(name = "{1}")
1616
public static Iterable<Object[]> data() {
1717
return Arrays.asList(new Object[][]{
18-
{LinkExtractor.builder().linkTypes(EnumSet.of(LinkType.URL)).build(), "URL"},
18+
{LinkExtractor.builder().linkTypes(EnumSet.of(LinkType.WWW)).build(), "WWW"},
1919
{LinkExtractor.builder().build(), "all"}
2020
});
2121
}
@@ -41,12 +41,26 @@ public void linked() {
4141
assertLinked("www.s.com","|www.s.com|");
4242
assertLinked("www.fo.uk","|www.fo.uk|");
4343
}
44-
44+
45+
@Test
46+
public void html() {
47+
assertLinked("<a href=\"somelink\">www.example.org</a>", "<a href=\"somelink\">|www.example.org|</a>");
48+
assertLinked("<a href=\"www.example.org\">sometext</a>", "<a href=\"|www.example.org|\">sometext</a>");
49+
assertLinked("<p>www.example.org</p>", "<p>|www.example.org|</p>");
50+
}
51+
52+
@Test
53+
public void multiple() {
54+
assertLinked("www.one.org/ www.two.org/", "|www.one.org/| |www.two.org/|");
55+
assertLinked("www.one.org/ : www.two.org/", "|www.one.org/| : |www.two.org/|");
56+
assertLinked("(www.one.org/)(www.two.org/)", "(|www.one.org/|)(|www.two.org/|)");
57+
}
58+
4559
@Test
46-
public void schemes() {
47-
assertLinked("http://www.something.com","|http://www.something.com|");
48-
assertLinked("http://something.com","|http://something.com|");
49-
assertLinked("http://something.co.uk","|http://something.co.uk|");
60+
public void international() {
61+
assertLinked("www.üñîçøðé.com/ä", "|www.üñîçøðé.com|");
62+
assertLinked("www.example.org/\u00A1", "|www.example.org/\u00A1|");
63+
assertLinked("www.example.org/\u00A2", "|www.example.org/\u00A2|");
5064
}
5165

5266
@Override
@@ -55,6 +69,6 @@ protected LinkExtractor getLinkExtractor() {
5569
}
5670

5771
private void assertLinked(String input, String expected) {
58-
super.assertLinked(input, expected, LinkType.URL);
72+
super.assertLinked(input, expected, LinkType.WWW);
5973
}
6074
}

0 commit comments

Comments
 (0)