Skip to content

armgit / nutch

Public Imported from GitHub
0

Apache Nutch is an extensible and scalable web crawler

NUTCH-1806 Delegate processing of URL domains to crawler commons - add unit test for URLs without host/domain (cf. NUTCH-2450)

Sebastian Nagelf6bcec9200f4
diff --git a/src/test/org/apache/nutch/util/TestURLUtil.java b/src/test/org/apache/nutch/util/TestURLUtil.java
index eaaf7d0c7..ad636048a 100644
--- a/src/test/org/apache/nutch/util/TestURLUtil.java
+++ b/src/test/org/apache/nutch/util/TestURLUtil.java
@@ -71,6 +71,11 @@ public class TestURLUtil {
// test non-ascii
url = new URL("http://www.example.商業.tw");
Assert.assertEquals("example.商業.tw", URLUtil.getDomainName(url));
+
+ // test URL without host/authority
+ url = new URL("file:/path/index.html");
+ Assert.assertNotNull(URLUtil.getDomainName(url));
+ Assert.assertEquals("", URLUtil.getDomainName(url));
}
@Test