1 package org.openejb.loader; 2 5 6 import junit.framework.*; 7 import org.openejb.loader.SystemClassPath; 8 9 import java.net.URL ; 10 11 public class SystemClassPathTest extends TestCase { 12 SystemClassPath systemClassPath; 13 14 public void testAddJarToPath() throws Exception { 15 SystemClassPath systemClassPath = new SystemClassPath(); 16 17 ClassLoader systemClassLoader = ClassLoader.getSystemClassLoader(); 18 19 try { 20 systemClassLoader.loadClass("org.apache.commons.io.HexDump"); 21 fail("Class already exists"); 22 } catch (ClassNotFoundException e) { 23 } 25 26 URL commonsIoJar = new URL ("http://www.ibiblio.org/maven/commons-io/jars/commons-io-1.0.jar"); 27 systemClassPath.addJarToPath(commonsIoJar); 28 29 try { 30 systemClassLoader.loadClass("org.apache.commons.io.HexDump"); 31 } catch (ClassNotFoundException e) { 32 fail("Class should exist"); 34 } 35 } 36 } | Popular Tags |