1 26 27 package net.sourceforge.groboutils.util.classes.v1.jdk2; 28 29 import net.sourceforge.groboutils.util.classes.v1.*; 30 import net.sourceforge.groboutils.junit.v1.iftc.*; 31 import junit.framework.Test; 32 import junit.framework.TestCase; 33 import junit.framework.TestSuite; 34 35 import java.net.URL ; 36 37 38 49 public class UrlClassLoaderOnlineJDK12UTest extends TestCase 50 { 51 private static final Class THIS_CLASS = UrlClassLoaderOnlineJDK12UTest.class; 52 53 public UrlClassLoaderOnlineJDK12UTest( String name ) 54 { 55 super( name ); 56 } 57 58 public static Test suite() 59 { 60 InterfaceTestSuite suite = IUrlClassLoaderOnlineUTestI.suite(); 61 suite.addTestSuite( THIS_CLASS ); 62 suite.addFactory( new CxFactory( "A" ) { 63 public Object createImplObject() { 64 return createLoader(); 65 } 66 } ); 67 68 return suite; 69 } 70 71 public static void main( String [] args ) 72 { 73 String [] name = { THIS_CLASS.getName() }; 74 75 78 junit.textui.TestRunner.main( name ); 79 } 80 81 protected void setUp() throws Exception 82 { 83 super.setUp(); 84 85 } 87 88 89 protected void tearDown() throws Exception 90 { 91 93 super.tearDown(); 94 } 95 96 97 protected static UrlClassLoader createLoader() 98 { 99 return new UrlClassLoader(); 100 } 101 102 103 106 public void testConvertUrl1() 107 { 108 assertNull( 109 "returned URL must be null.", 110 createLoader().convertUrl( null ) ); 111 } 112 113 114 public void testConvertUrl2() 115 { 116 URL url = createLoader().convertUrl( "http://yo.mama" ); 117 assertNotNull( 118 "convertURL returned null.", 119 url ); 120 assertTrue( 121 "convertURL did not format right (received "+url+").", 122 url.toString().equals( "http://yo.mama" ) 123 || url.toString().equals( "http://yo.mama/" ) ); 124 } 125 126 127 public void testConvertUrl3() 128 { 129 URL url = createLoader().convertUrl( "afile.txt" ); 130 assertNotNull( 131 "convertURL returned null.", 132 url ); 133 assertEquals( 134 "convertURL did not format right.", 135 url.toString(), 136 "file:afile.txt" ); 137 } 138 } 139 | Popular Tags |