From ff8a0111c0d9fefe6e4cb9c88b2791004552915f Mon Sep 17 00:00:00 2001 From: Simon Kitching Date: Wed, 2 Aug 2006 00:08:20 +0000 Subject: [PATCH] Have DefaultConfigTestCase explicitly set up its classpath. When run from ant, log4j is not on the classpath so using the default setup works; however when run from maven2 surefire, log4j is on the path. Explicitly controlling the test classpath works in both cases. git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/logging/trunk@427808 13f79535-47bb-0310-9956-ffa450edef68 --- .../commons/logging/jdk14/DefaultConfigTestCase.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/test/org/apache/commons/logging/jdk14/DefaultConfigTestCase.java b/src/test/org/apache/commons/logging/jdk14/DefaultConfigTestCase.java index 28ecbc7..8dc52bf 100644 --- a/src/test/org/apache/commons/logging/jdk14/DefaultConfigTestCase.java +++ b/src/test/org/apache/commons/logging/jdk14/DefaultConfigTestCase.java @@ -29,6 +29,8 @@ import junit.framework.TestSuite; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.apache.commons.logging.PathableClassLoader; +import org.apache.commons.logging.PathableTestSuite; /** @@ -87,7 +89,13 @@ public class DefaultConfigTestCase extends TestCase { * Return the tests included in this test suite. */ public static Test suite() throws Exception { - return (new TestSuite(DefaultConfigTestCase.class)); + PathableClassLoader loader = new PathableClassLoader(null); + loader.useExplicitLoader("junit.", Test.class.getClassLoader()); + loader.addLogicalLib("testclasses"); + loader.addLogicalLib("commons-logging"); + + Class testClass = loader.loadClass(DefaultConfigTestCase.class.getName()); + return new PathableTestSuite(testClass, loader); } /**