diff --git a/src/test/org/apache/commons/lang/ClassUtilsTest.java b/src/test/org/apache/commons/lang/ClassUtilsTest.java index fae98615e..61894e36d 100644 --- a/src/test/org/apache/commons/lang/ClassUtilsTest.java +++ b/src/test/org/apache/commons/lang/ClassUtilsTest.java @@ -501,30 +501,6 @@ public class ClassUtilsTest extends TestCase { assertGetClassThrowsException( className, ClassNotFoundException.class ); } - /** - * Creates a new instance of URLClassLoader with the system class loader's URLs and a null parent - * class loader. - * - * @see ClassLoader#getSystemClassLoader() - * @see URLClassLoader#newInstance(URL[], ClassLoader) - * @return the resulting class loader - */ - public static ClassLoader newSystemClassLoader() throws SecurityException, IllegalArgumentException { - ClassLoader systemClassLoader = ClassLoader.getSystemClassLoader(); - ClassLoader myClassLoader = ClassUtilsTest.class.getClassLoader(); - if (!(myClassLoader instanceof URLClassLoader)) { - fail("ClassUtilsTest ClassLoader = " + (myClassLoader == null ? null : myClassLoader.getClass().getName())); - } - if (!(systemClassLoader instanceof URLClassLoader)) { - fail("System ClassLoader = " + (systemClassLoader == null ? null : systemClassLoader.getClass().getName())); - } - if (!myClassLoader.equals(systemClassLoader)) { - fail("ClassUtilsTest= " + myClassLoader + " System=" + systemClassLoader); - } - URLClassLoader urlScl = (URLClassLoader) myClassLoader; - return URLClassLoader.newInstance(urlScl.getURLs(), null); - } - // Show the Java bug: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4071957 // We may have to delete this if a JDK fixes the bug. public void testShowJavaBug() throws Exception { diff --git a/src/test/org/apache/commons/lang/enum/EnumTest.java b/src/test/org/apache/commons/lang/enum/EnumTest.java index eaaedaae4..823b5d088 100644 --- a/src/test/org/apache/commons/lang/enum/EnumTest.java +++ b/src/test/org/apache/commons/lang/enum/EnumTest.java @@ -32,7 +32,6 @@ import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; -import org.apache.commons.lang.ClassUtilsTest; import org.apache.commons.lang.SerializationUtils; /** @@ -456,7 +455,11 @@ public final class EnumTest extends TestCase { assertTrue(colorEnum.equals(colorEnum)); assertNotNull(ColorEnum.class.getClassLoader()); // set up: - ClassLoader classLoader = ClassUtilsTest.newSystemClassLoader(); + ClassLoader myClassLoader = EnumTest.class.getClassLoader(); + if (!(myClassLoader instanceof URLClassLoader)) { + fail("EnumTest ClassLoader = " + (myClassLoader == null ? null : myClassLoader.getClass().getName())); + } + ClassLoader classLoader = URLClassLoader.newInstance( ((URLClassLoader)myClassLoader).getURLs(), null); Object enumObjectFromOtherClassLoader = this.getColorEnum(classLoader, colorEnum.getName()); // the real test, part 1. diff --git a/src/test/org/apache/commons/lang/enums/EnumTest.java b/src/test/org/apache/commons/lang/enums/EnumTest.java index a25e4a0c1..8f92e985a 100644 --- a/src/test/org/apache/commons/lang/enums/EnumTest.java +++ b/src/test/org/apache/commons/lang/enums/EnumTest.java @@ -30,7 +30,6 @@ import junit.framework.AssertionFailedError; import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; -import org.apache.commons.lang.ClassUtilsTest; import org.apache.commons.lang.SerializationUtils; /** @@ -454,7 +453,11 @@ public final class EnumTest extends TestCase { assertTrue(colorEnum.equals(colorEnum)); assertNotNull(ColorEnum.class.getClassLoader()); // set up: - ClassLoader classLoader = ClassUtilsTest.newSystemClassLoader(); + ClassLoader myClassLoader = EnumTest.class.getClassLoader(); + if (!(myClassLoader instanceof URLClassLoader)) { + fail("EnumTest ClassLoader = " + (myClassLoader == null ? null : myClassLoader.getClass().getName())); + } + ClassLoader classLoader = URLClassLoader.newInstance( ((URLClassLoader)myClassLoader).getURLs(), null); Object enumObjectFromOtherClassLoader = this.getColorEnum(classLoader, colorEnum.getName()); // the real test, part 1.