Skip to content

Commit 3815d13

Browse files
NUTCH-3136 Upgrade crawler-commons dependency
Update URLUtil test to adapt to a change in the public suffix list
1 parent 9202bb5 commit 3815d13

1 file changed

Lines changed: 15 additions & 5 deletions

File tree

‎src/test/org/apache/nutch/util/TestURLUtil.java‎

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,13 @@ public void testGetDomainName() throws Exception {
7878
assertEquals("example.2000.hu", URLUtil.getDomainName(url));
7979

8080
// test non-ascii
81-
url = new URL("http://www.example.商業.tw");
82-
assertEquals("example.商業.tw", URLUtil.getDomainName(url));
81+
url = new URL("http://www.example.flå.no");
82+
assertEquals("example.flå.no", URLUtil.getDomainName(url));
83+
url = new URL("http://www.example.栃木.jp");
84+
assertEquals("example.栃木.jp", URLUtil.getDomainName(url));
85+
// broken by https://github.com/publicsuffix/list/commit/408a7b0bdec993884865baaa2f0d14cc9a060885
86+
// url = new URL("http://www.example.商業.tw");
87+
// Assert.assertEquals("example.商業.tw", URLUtil.getDomainName(url));
8388

8489
// test URL without host/authority
8590
url = new URL("file:/path/index.html");
@@ -141,9 +146,14 @@ public void testGetDomainSuffix() throws Exception {
141146
url = new URL("http://www.example.2000.hu");
142147
assertEquals("2000.hu", URLUtil.getDomainSuffix(url));
143148

144-
// test non-ascii
145-
url = new URL("http://www.example.商業.tw");
146-
assertEquals("xn--czrw28b.tw", URLUtil.getDomainSuffix(url));
149+
// test non-ASCII
150+
url = new URL("http://www.example.flå.no");
151+
assertEquals("xn--fl-zia.no", URLUtil.getDomainSuffix(url));
152+
url = new URL("http://www.example.栃木.jp");
153+
assertEquals("xn--4pvxs.jp", URLUtil.getDomainSuffix(url));
154+
// broken by https://github.com/publicsuffix/list/commit/408a7b0bdec993884865baaa2f0d14cc9a060885
155+
// url = new URL("http://www.example.商業.tw");
156+
// assertEquals("xn--czrw28b.tw", URLUtil.getDomainSuffix(url));
147157
}
148158

149159
@Test

0 commit comments

Comments
 (0)