Browse Source

Tweak: in case junit-3.8.1.jar and junit-4.0.jar are on CP but in that

order, and running JDK 1.4-, at least run JUnit 3.x tests.


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@382127 13f79535-47bb-0310-9956-ffa450edef68
master
Jesse N. Glick 19 years ago
parent
commit
5b464967fa
1 changed files with 5 additions and 1 deletions
  1. +5
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.java

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

@@ -266,8 +266,12 @@ public class JUnitTestRunner implements TestListener, JUnitTaskMirror.JUnitTestR

try {
Class junit4TestAdapterClass = null;
// Note that checking for JDK 5 directly won't work; under JDK 4, this will already have failed.
// Check for JDK 5 first. Will *not* help on JDK 1.4 if only junit-4.0.jar in
// CP because in that case linkage of whole task will already have
// failed! But will help if CP has junit-3.8.1.jar:junit-4.0.jar.
// In that case first C.fN will fail with CNFE and we will avoid UnsupportedClassVersionError.
try {
Class.forName("java.lang.annotation.Annotation");
if (loader == null) {
junit4TestAdapterClass = Class.forName("junit.framework.JUnit4TestAdapter");
} else {


Loading…
Cancel
Save