Skip to content

Commit

Permalink
NUTCH-1319 adding test to accomodate HostURLNormalizer
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.apache.org/repos/asf/nutch/trunk@1353884 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
Markus Jelsma committed Jun 26, 2012
1 parent 3570e73 commit 2a424ee
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/test/org/apache/nutch/net/TestURLNormalizers.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,20 @@ public void testURLNormalizers() {

// NUTCH-1011 - Get rid of superfluous slashes
try {
String normalizedSlashes = normalizers.normalize("http://www.example.org//path/to//somewhere.html", URLNormalizers.SCOPE_DEFAULT);
assertEquals(normalizedSlashes, "http://www.example.org/path/to/somewhere.html");
String normalizedSlashes = normalizers.normalize("http://www.example.com//path/to//somewhere.html", URLNormalizers.SCOPE_DEFAULT);
assertEquals(normalizedSlashes, "http://www.example.com/path/to/somewhere.html");
} catch (MalformedURLException mue) {
fail(mue.toString());
}


// HostNormalizer NUTCH-1319
try {
String normalizedHost = normalizers.normalize("http://www.example.org//path/to//somewhere.html", URLNormalizers.SCOPE_DEFAULT);
assertEquals(normalizedHost, "http://example.org/path/to/somewhere.html");
} catch (MalformedURLException mue) {
fail(mue.toString());
}

// check the order
int pos1 = -1, pos2 = -1;
URLNormalizer[] impls = normalizers.getURLNormalizers(URLNormalizers.SCOPE_DEFAULT);
Expand Down

0 comments on commit 2a424ee

Please sign in to comment.