Browse Source

Bug 41940 : works for JUnit's own runners, but not for Ant's. Ideas?

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@532247 13f79535-47bb-0310-9956-ffa450edef68
master
Jan Materne 18 years ago
parent
commit
db412627e1
1 changed files with 12 additions and 0 deletions
  1. +12
    -0
      src/tests/junit/org/apache/tools/ant/BuildFileTest.java

+ 12
- 0
src/tests/junit/org/apache/tools/ant/BuildFileTest.java View File

@@ -22,6 +22,7 @@ import junit.framework.TestCase;
import java.io.File;
import java.io.PrintStream;
import java.net.URL;
import java.util.Hashtable;

/**
* A BuildFileTest is a TestCase which executes targets from an Ant buildfile
@@ -67,6 +68,17 @@ public abstract class BuildFileTest extends TestCase {
* test target depend on it.
*/
protected void tearDown() throws Exception {
if (project == null) {
/*
* Maybe the BuildFileTest was subclassed and there is
* no initialized project. So we could avoid getting a
* NPE.
* If there is an initialized project getTargets() does
* not return null as it is initialized by an empty
* HashSet.
*/
return;
}
final String tearDown = "tearDown";
if (project.getTargets().containsKey(tearDown)) {
project.executeTarget(tearDown);


Loading…
Cancel
Save