Author: bodewig
Date: Fri Aug 22 07:02:21 2008
New Revision: 688084

URL: http://svn.apache.org/viewvc?rev=688084&view=rev
Log:
May need special JUnit4 handling if a suite method has been used as well.  PR 
43892.

Modified:
    
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.java

Modified: 
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.java
URL: 
http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.java?rev=688084&r1=688083&r2=688084&view=diff
==============================================================================
--- 
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.java
 (original)
+++ 
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.java
 Fri Aug 22 07:02:21 2008
@@ -94,6 +94,9 @@
      */
     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 @@
                         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 @@
                     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 {


Reply via email to