ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/junit JUnitVersionHelper.java PlainJUnitResultFormatter.java XMLJUnitResultFormatter.java
Date Thu, 15 Nov 2001 08:47:49 GMT
bodewig     01/11/15 00:47:49

  Modified:    .        WHATSNEW
               src/main/org/apache/tools/ant/taskdefs/optional/junit
                        JUnitVersionHelper.java
                        PlainJUnitResultFormatter.java
                        XMLJUnitResultFormatter.java
  Log:
  don't assume a JUnit Test extends TestCase
  
  PR: 4870
  
  Revision  Changes    Path
  1.168     +3 -0      jakarta-ant/WHATSNEW
  
  Index: WHATSNEW
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/WHATSNEW,v
  retrieving revision 1.167
  retrieving revision 1.168
  diff -u -r1.167 -r1.168
  --- WHATSNEW	2001/11/13 14:49:47	1.167
  +++ WHATSNEW	2001/11/15 08:47:49	1.168
  @@ -34,6 +34,9 @@
   
   * <fixcrlf> would fail for files that contained lines longer than 8kB.
   
  +* Some junit formatters incorrectly assumed that all testcases would
  +  inherit from junit.framework.TestCase.
  +
   Other changes:
   --------------
   
  
  
  
  1.2       +4 -3      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitVersionHelper.java
  
  Index: JUnitVersionHelper.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitVersionHelper.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- JUnitVersionHelper.java	2001/10/23 10:23:18	1.1
  +++ JUnitVersionHelper.java	2001/11/15 08:47:49	1.2
  @@ -56,6 +56,7 @@
   
   import java.lang.reflect.Method;
   
  +import junit.framework.Test;
   import junit.framework.TestCase;
   
   /**
  @@ -63,7 +64,7 @@
    * different JUnit releases.
    *
    * @author <a href="mailto:stefan.bodewig@epost.de">Stefan Bodewig</a>
  - * @version $Revision: 1.1 $
  + * @version $Revision: 1.2 $
    */
   public class JUnitVersionHelper {
   
  @@ -85,8 +86,8 @@
        * access to the name of a TestCase via reflection that is
        * supposed to work with version before and after JUnit 3.7.
        */
  -    public static String getTestCaseName(TestCase t) {
  -        if (testCaseName != null) {
  +    public static String getTestCaseName(Test t) {
  +        if (t instanceof TestCase && testCaseName != null) {
               try {
                   return (String) testCaseName.invoke(t, new Object[0]);
               } catch (Throwable e) {}
  
  
  
  1.10      +1 -1      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/PlainJUnitResultFormatter.java
  
  Index: PlainJUnitResultFormatter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/PlainJUnitResultFormatter.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- PlainJUnitResultFormatter.java	2001/10/29 14:25:07	1.9
  +++ PlainJUnitResultFormatter.java	2001/11/15 08:47:49	1.10
  @@ -200,7 +200,7 @@
       public void endTest(Test test) {
           synchronized (wri) {
               wri.print("Testcase: " 
  -                      + JUnitVersionHelper.getTestCaseName((TestCase) test));
  +                      + JUnitVersionHelper.getTestCaseName(test));
               if (Boolean.TRUE.equals(failed.get(test))) {
                   return;
               }
  
  
  
  1.15      +1 -1      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/XMLJUnitResultFormatter.java
  
  Index: XMLJUnitResultFormatter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/XMLJUnitResultFormatter.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- XMLJUnitResultFormatter.java	2001/10/29 14:25:07	1.14
  +++ XMLJUnitResultFormatter.java	2001/11/15 08:47:49	1.15
  @@ -195,7 +195,7 @@
   
           Element currentTest = doc.createElement(TESTCASE);
           currentTest.setAttribute(ATTR_NAME, 
  -                                 JUnitVersionHelper.getTestCaseName((TestCase) t));
  +                                 JUnitVersionHelper.getTestCaseName(t));
           rootElement.appendChild(currentTest);
           testElements.put(t, currentTest);
       }
  
  
  

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message