1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 package org.archive.crawler.url.canonicalize;
24
25 import org.apache.commons.httpclient.URIException;
26 import org.archive.net.UURIFactory;
27
28 import junit.framework.TestCase;
29
30 /***
31 * Test stripping 'www' if present.
32 * @author stack
33 * @version $Date: 2006-09-18 20:32:47 +0000 (Mon, 18 Sep 2006) $, $Revision: 4634 $
34 */
35 public class StripWWWNRuleTest extends TestCase {
36
37 public void testCanonicalize() throws URIException {
38 String url = "http://WWW.aRchive.Org/index.html";
39 String expectedResult = "http://aRchive.Org/index.html";
40 String result = (new StripWWWNRule("test")).
41 canonicalize(url, UURIFactory.getInstance(url));
42 assertTrue("Failed " + result, expectedResult.equals(result));
43 url = "http://www001.aRchive.Org/index.html";
44 result = (new StripWWWNRule("test")).
45 canonicalize(url, UURIFactory.getInstance(url));
46 assertTrue("Failed " + result, expectedResult.equals(result));
47 url = "http://www3.aRchive.Org/index.html";
48 result = (new StripWWWNRule("test")).
49 canonicalize(url, UURIFactory.getInstance(url));
50 assertTrue("Failed " + result, expectedResult.equals(result));
51 }
52 }