git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@1050993 13f79535-47bb-0310-9956-ffa450edef68master
@@ -718,6 +718,7 @@ public class JUnitTask extends Task { | |||||
addClasspathEntry("/org/apache/tools/ant/launch/AntMain.class"); | addClasspathEntry("/org/apache/tools/ant/launch/AntMain.class"); | ||||
addClasspathEntry("/org/apache/tools/ant/Task.class"); | addClasspathEntry("/org/apache/tools/ant/Task.class"); | ||||
addClasspathEntry("/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.class"); | addClasspathEntry("/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.class"); | ||||
addClasspathEntry("/org/apache/tools/ant/taskdefs/optional/junit/JUnit4TestMethodAdapter.class"); | |||||
} | } | ||||
private static JUnitTaskMirror createMirror(JUnitTask task, ClassLoader loader) { | private static JUnitTaskMirror createMirror(JUnitTask task, ClassLoader loader) { | ||||
@@ -20,6 +20,7 @@ | |||||
<property name="input" location="${java.io.tmpdir}/testinput"/> | <property name="input" location="${java.io.tmpdir}/testinput"/> | ||||
<property name="output" location="${java.io.tmpdir}/testoutput"/> | <property name="output" location="${java.io.tmpdir}/testoutput"/> | ||||
<available property="jdk1.6+" classname="java.util.ServiceLoader"/> | <available property="jdk1.6+" classname="java.util.ServiceLoader"/> | ||||
<available property="jdk1.5+" classname="java.net.Proxy"/> | |||||
<target name="tearDown"> | <target name="tearDown"> | ||||
<delete dir="${input}"/> | <delete dir="${input}"/> | ||||
@@ -300,4 +300,53 @@ public class BTest extends TestCase { | |||||
</au:expectfailure> | </au:expectfailure> | ||||
</target> | </target> | ||||
<target name="-setUp.methods" depends="setUp"> | |||||
<property name="junit-3.8.2.location" location="../../../../lib/optional/junit-3.8.2.jar"/> | |||||
<property name="junit-4.8.1.location" location="../../../../lib/optional/junit-4.8.1.jar"/> | |||||
<condition property="test.can.run"> | |||||
<and> | |||||
<available file="${junit-3.8.2.location}"/> | |||||
<available file="${junit-4.8.1.location}"/> | |||||
<isset property="jdk1.5+"/> | |||||
</and> | |||||
</condition> | |||||
</target> | |||||
<target name="testFailNone" depends="-setUp.methods" if="test.can.run"> | |||||
<echo file="${input}/T1.java">public class T1 extends | |||||
junit.framework.TestCase { | |||||
public void testOK() {} | |||||
public void testBad() {throw new RuntimeException("failed");} | |||||
}</echo> | |||||
<echo file="${input}/T2.java"> | |||||
import org.junit.Test; | |||||
public class T2 { | |||||
@Test | |||||
public void ok() {} | |||||
@Test | |||||
public void bad() { | |||||
throw new RuntimeException("failed");} | |||||
}</echo> | |||||
<javac srcdir="${input}" destdir="${output}" includes="T1.java,T2.java" source="5" | |||||
includeantruntime="false" > | |||||
<classpath> | |||||
<pathelement path="${java.class.path}"/> | |||||
</classpath> | |||||
</javac> | |||||
<junit fork="true" printsummary="true" failureproperty="test.failed" errorproperty="test.haseerror"> | |||||
<classpath> | |||||
<pathelement location="${output}"/> | |||||
<pathelement location="${junit-3.8.2.location}"/> | |||||
<pathelement location="${junit-4.8.1.location}"/> | |||||
</classpath> | |||||
<test name="T1" methods="testOK" /> | |||||
<test name="T2" methods="ok" /> | |||||
</junit> | |||||
<au:assertFalse> | |||||
<or> | |||||
<isset property="test.failed"/> | |||||
<isset property="test.haserror"/> | |||||
</or> | |||||
</au:assertFalse> | |||||
</target> | |||||
</project> | </project> |
@@ -147,7 +147,6 @@ undefined='<xsl:value-of select="$undefined"/>' | |||||
</xslt> | </xslt> | ||||
</target> | </target> | ||||
<available property="jdk1.5+" classname="java.net.Proxy"/> | |||||
<target name="testTraceJdk14" unless="jdk1.5+" depends="setUp"> | <target name="testTraceJdk14" unless="jdk1.5+" depends="setUp"> | ||||
<xslt in="${legacy.dir}/data.xml" | <xslt in="${legacy.dir}/data.xml" | ||||