1 25 26 package org.archive.util; 27 28 import org.apache.commons.httpclient.URIException; 29 30 import junit.framework.Test; 31 import junit.framework.TestCase; 32 import junit.framework.TestSuite; 33 34 40 public class SURTTest extends TestCase { 41 47 public SURTTest(final String testName) { 48 super(testName); 49 } 50 51 57 public static void main(String argv[]) { 58 junit.textui.TestRunner.run(suite()); 59 } 60 61 66 public static Test suite() { 67 return new TestSuite(SURTTest.class); 68 } 69 70 public void testMisc() throws URIException { 71 assertEquals("", 72 "http://(org,archive,www,)", 73 SURT.fromURI("http://www.archive.org")); 74 75 assertEquals("", 76 "http://(org,archive,www,)/movies/movies.php", 77 SURT.fromURI("http://www.archive.org/movies/movies.php")); 78 79 assertEquals("", 80 "http://(org,archive,www,:8080)/movies/movies.php", 81 SURT.fromURI("http://www.archive.org:8080/movies/movies.php")); 82 83 assertEquals("", 84 "http://(org,archive,www,@user:pass)/movies/movies.php", 85 SURT.fromURI("http://user:pass@www.archive.org/movies/movies.php")); 86 87 assertEquals("", 88 "http://(org,archive,www,:8080@user:pass)/movies/movies.php", 89 SURT.fromURI("http://user:pass@www.archive.org:8080/movies/movies.php")); 90 91 assertEquals("", 92 "http://(org,archive,www,)/movies/movies.php#top", 93 SURT.fromURI("http://www.archive.org/movies/movies.php#top")); 94 } 95 96 public void testAtSymbolInPath() throws URIException { 97 assertEquals("@ in path", 98 "http://(com,example,www,)/foo@bar", 99 SURT.fromURI("http://www.example.com/foo@bar")); 100 } 101 102 108 public void testDottedQuadAuthority() throws URIException { 109 assertEquals("dotted-quad IP authority", 110 "http://(127.2.34.5)/foo", 111 SURT.fromURI("http://127.2.34.5/foo")); 112 } 113 } 114 115 | Popular Tags |