Browse Source

Make <junit> work with JUnit 3.5 as well.

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@268534 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 24 years ago
parent
commit
ce5785476b
4 changed files with 43 additions and 5 deletions
  1. +10
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.java
  2. +12
    -2
      src/main/org/apache/tools/ant/taskdefs/optional/junit/PlainJUnitResultFormatter.java
  3. +10
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/junit/SummaryJUnitResultFormatter.java
  4. +11
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/junit/XMLJUnitResultFormatter.java

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

@@ -237,7 +237,7 @@ public class JUnitTestRunner implements TestListener {
public void endTest(Test test) {}

/**
* Interface TestListener.
* Interface TestListener for JUnit &lt;= 3.4.
*
* <p>A Test failed.
*/
@@ -247,6 +247,15 @@ public class JUnitTestRunner implements TestListener {
}
}

/**
* Interface TestListener for JUnit &gt; 3.4.
*
* <p>A Test failed.
*/
public void addFailure(Test test, AssertionFailedError t) {
addFailure(test, (Throwable) t);
}

/**
* Interface TestListener.
*


+ 12
- 2
src/main/org/apache/tools/ant/taskdefs/optional/junit/PlainJUnitResultFormatter.java View File

@@ -59,13 +59,14 @@ import org.apache.tools.ant.BuildException;
import java.io.*;
import java.text.NumberFormat;

import junit.framework.AssertionFailedError;
import junit.framework.Test;
import junit.framework.TestCase;

/**
* Prints plain text output of the test to a specified Writer.
*
* @author <a href="mailto:stefan.bodewig@megabit.net">Stefan Bodewig</a>
* @author <a href="mailto:stefan.bodewig@epost.de">Stefan Bodewig</a>
*/

public class PlainJUnitResultFormatter implements JUnitResultFormatter {
@@ -172,7 +173,7 @@ public class PlainJUnitResultFormatter implements JUnitResultFormatter {
}

/**
* Interface TestListener.
* Interface TestListener for JUnit &lt;= 3.4.
*
* <p>A Test failed.
*/
@@ -180,6 +181,15 @@ public class PlainJUnitResultFormatter implements JUnitResultFormatter {
formatError("\tFAILED", test, t);
}

/**
* Interface TestListener for JUnit &gt; 3.4.
*
* <p>A Test failed.
*/
public void addFailure(Test test, AssertionFailedError t) {
addFailure(test, (Throwable) t);
}

/**
* Interface TestListener.
*


+ 10
- 1
src/main/org/apache/tools/ant/taskdefs/optional/junit/SummaryJUnitResultFormatter.java View File

@@ -57,6 +57,7 @@ package org.apache.tools.ant.taskdefs.optional.junit;
import java.text.NumberFormat;
import java.io.IOException;
import java.io.OutputStream;
import junit.framework.AssertionFailedError;
import junit.framework.Test;

import org.apache.tools.ant.BuildException;
@@ -64,7 +65,7 @@ import org.apache.tools.ant.BuildException;
/**
* Prints short summary output of the test to Ant's logging system.
*
* @author <a href="mailto:stefan.bodewig@megabit.net">Stefan Bodewig</a>
* @author <a href="mailto:stefan.bodewig@epost.de">Stefan Bodewig</a>
*/
public class SummaryJUnitResultFormatter implements JUnitResultFormatter {
@@ -98,6 +99,14 @@ public class SummaryJUnitResultFormatter implements JUnitResultFormatter {
* Empty
*/
public void addFailure(Test test, Throwable t) {}
/**
* Interface TestListener for JUnit &gt; 3.4.
*
* <p>A Test failed.
*/
public void addFailure(Test test, AssertionFailedError t) {
addFailure(test, (Throwable) t);
}
/**
* Empty
*/


+ 11
- 1
src/main/org/apache/tools/ant/taskdefs/optional/junit/XMLJUnitResultFormatter.java View File

@@ -64,6 +64,7 @@ import org.w3c.dom.*;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.util.DOMElementWriter;

import junit.framework.AssertionFailedError;
import junit.framework.Test;
import junit.framework.TestCase;

@@ -178,7 +179,7 @@ public class XMLJUnitResultFormatter implements JUnitResultFormatter {
}

/**
* Interface TestListener.
* Interface TestListener for JUnit &lt;= 3.4.
*
* <p>A Test failed.
*/
@@ -186,6 +187,15 @@ public class XMLJUnitResultFormatter implements JUnitResultFormatter {
formatError("failure", test, t);
}

/**
* Interface TestListener for JUnit &gt; 3.4.
*
* <p>A Test failed.
*/
public void addFailure(Test test, AssertionFailedError t) {
addFailure(test, (Throwable) t);
}

/**
* Interface TestListener.
*


Loading…
Cancel
Save