Browse Source

May need special JUnit4 handling if a suite method has been used as well. PR 43892.

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@688084 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 17 years ago
parent
commit
71c5e730ed
1 changed files with 7 additions and 3 deletions
  1. +7
    -3
      src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.java

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

@@ -94,6 +94,9 @@ public class JUnitTestRunner implements TestListener, JUnitTaskMirror.JUnitTestR
*/
private Permissions perm = null;

private static final String JUNIT_4_TEST_ADAPTER
= "junit.framework.JUnit4TestAdapter";

private static final String[] DEFAULT_TRACE_FILTERS = new String[] {
"junit.framework.TestCase",
"junit.framework.TestResult",
@@ -370,10 +373,10 @@ public class JUnitTestRunner implements TestListener, JUnitTaskMirror.JUnitTestR
Class.forName("java.lang.annotation.Annotation");
if (loader == null) {
junit4TestAdapterClass =
Class.forName("junit.framework.JUnit4TestAdapter");
Class.forName(JUNIT_4_TEST_ADAPTER);
} else {
junit4TestAdapterClass =
Class.forName("junit.framework.JUnit4TestAdapter",
Class.forName(JUNIT_4_TEST_ADAPTER,
true, loader);
}
} catch (ClassNotFoundException e) {
@@ -419,7 +422,8 @@ public class JUnitTestRunner implements TestListener, JUnitTaskMirror.JUnitTestR
logTestListenerEvent("tests to run: " + suite.countTestCases());
suite.run(res);
} finally {
if (junit4) {
if (junit4 ||
suite.getClass().getName().equals(JUNIT_4_TEST_ADAPTER)) {
int[] cnts = findJUnit4FailureErrorCount(res);
junitTest.setCounts(res.runCount(), cnts[0], cnts[1]);
} else {


Loading…
Cancel
Save