Browse Source

System.err debugging of a problem in Gump

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@1514675 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 12 years ago
parent
commit
52d21be98e
1 changed files with 19 additions and 0 deletions
  1. +19
    -0
      src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.java

+ 19
- 0
src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.java View File

@@ -367,6 +367,8 @@ public class JUnitTestRunner implements TestListener, JUnitTaskMirror.JUnitTestR
Throwable exception = null; Throwable exception = null;
boolean startTestSuiteSuccess = false; boolean startTestSuiteSuccess = false;


savedErr.println("Running test " + junitTest.getName() + " with {loader: " + loader + ", methods: " + methods + "}");

try { try {


try { try {
@@ -387,9 +389,11 @@ public class JUnitTestRunner implements TestListener, JUnitTaskMirror.JUnitTestR
try { try {
// check if there is a suite method // check if there is a suite method
suiteMethod = testClass.getMethod("suite", new Class[0]); suiteMethod = testClass.getMethod("suite", new Class[0]);
savedErr.println("found suite method");
} catch (NoSuchMethodException e) { } catch (NoSuchMethodException e) {
// no appropriate suite method found. We don't report any // no appropriate suite method found. We don't report any
// error here since it might be perfectly normal. // error here since it might be perfectly normal.
savedErr.println("didn't find suite method");
} }
} }


@@ -405,6 +409,7 @@ public class JUnitTestRunner implements TestListener, JUnitTaskMirror.JUnitTestR
boolean useSingleMethodAdapter = false; boolean useSingleMethodAdapter = false;


if (junit.framework.TestCase.class.isAssignableFrom(testClass)) { if (junit.framework.TestCase.class.isAssignableFrom(testClass)) {
savedErr.println("this is a JUnit3 test");
// Do not use JUnit 4 API for running JUnit 3.x // Do not use JUnit 4 API for running JUnit 3.x
// tests - it is not able to run individual test // tests - it is not able to run individual test
// methods. // methods.
@@ -428,12 +433,19 @@ public class JUnitTestRunner implements TestListener, JUnitTaskMirror.JUnitTestR
// will avoid UnsupportedClassVersionError. // will avoid UnsupportedClassVersionError.


try { try {
savedErr.println("trying to load java.lang.annotation.Annotation");
Class.forName("java.lang.annotation.Annotation"); Class.forName("java.lang.annotation.Annotation");
savedErr.println("found");
savedErr.println("trying to load org.apache.tools.ant.taskdefs.optional.junit.CustomJUnit4TestAdapterCache");
junit4TestAdapterCacheClass = Class.forName("org.apache.tools.ant.taskdefs.optional.junit.CustomJUnit4TestAdapterCache"); junit4TestAdapterCacheClass = Class.forName("org.apache.tools.ant.taskdefs.optional.junit.CustomJUnit4TestAdapterCache");
savedErr.println("found");
if (loader == null) { if (loader == null) {
savedErr.println("trying to load " + JUNIT_4_TEST_ADAPTER);
junit4TestAdapterClass = junit4TestAdapterClass =
Class.forName(JUNIT_4_TEST_ADAPTER); Class.forName(JUNIT_4_TEST_ADAPTER);
savedErr.println("found");
if (testMethodsSpecified) { if (testMethodsSpecified) {
savedErr.println("trying to load org.apache.tools.ant.taskdefs.optional.junit.JUnit4TestMethodAdapter");
/* /*
* We cannot try to load the JUnit4TestAdapter * We cannot try to load the JUnit4TestAdapter
* before trying to load JUnit4TestMethodAdapter * before trying to load JUnit4TestMethodAdapter
@@ -443,17 +455,22 @@ public class JUnitTestRunner implements TestListener, JUnitTaskMirror.JUnitTestR
*/ */
junit4TestAdapterClass = Class.forName( junit4TestAdapterClass = Class.forName(
"org.apache.tools.ant.taskdefs.optional.junit.JUnit4TestMethodAdapter"); "org.apache.tools.ant.taskdefs.optional.junit.JUnit4TestMethodAdapter");
savedErr.println("found");
useSingleMethodAdapter = true; useSingleMethodAdapter = true;
} }
} else { } else {
savedErr.println("trying to load " + JUNIT_4_TEST_ADAPTER);
junit4TestAdapterClass = junit4TestAdapterClass =
Class.forName(JUNIT_4_TEST_ADAPTER, Class.forName(JUNIT_4_TEST_ADAPTER,
true, loader); true, loader);
savedErr.println("found");
if (testMethodsSpecified) { if (testMethodsSpecified) {
savedErr.println("trying to load org.apache.tools.ant.taskdefs.optional.junit.JUnit4TestMethodAdapter");
junit4TestAdapterClass = junit4TestAdapterClass =
Class.forName( Class.forName(
"org.apache.tools.ant.taskdefs.optional.junit.JUnit4TestMethodAdapter", "org.apache.tools.ant.taskdefs.optional.junit.JUnit4TestMethodAdapter",
true, loader); true, loader);
savedErr.println("found");
useSingleMethodAdapter = true; useSingleMethodAdapter = true;
} }
} }
@@ -464,6 +481,7 @@ public class JUnitTestRunner implements TestListener, JUnitTaskMirror.JUnitTestR
junit4 = junit4TestAdapterClass != null; junit4 = junit4TestAdapterClass != null;


if (junit4) { if (junit4) {
savedErr.println("using JUnit4");
// Let's use it! // Let's use it!
Class[] formalParams; Class[] formalParams;
Object[] actualParams; Object[] actualParams;
@@ -479,6 +497,7 @@ public class JUnitTestRunner implements TestListener, JUnitTaskMirror.JUnitTestR
.getConstructor(formalParams). .getConstructor(formalParams).
newInstance(actualParams); newInstance(actualParams);
} else { } else {
savedErr.println("using JUnit3");
// Use JUnit 3. // Use JUnit 3.


// try to extract a test suite automatically this // try to extract a test suite automatically this


Loading…
Cancel
Save