junit
junit4 is the "old" release https://github.com/junit-team/junit4/wiki/Download-and-Install Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
parent
cc6cd29661
commit
fadee31f21
4 changed files with 44 additions and 3 deletions
29
build.xml
29
build.xml
|
@ -1,20 +1,26 @@
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<project>
|
<project name="HelloWorld" basedir="." default="main">
|
||||||
|
|
||||||
<property name="src.dir" value="src"/>
|
<property name="src.dir" value="src"/>
|
||||||
<property name="build.dir" value="build"/>
|
<property name="build.dir" value="build"/>
|
||||||
<property name="jar.dir" value="${build.dir}/jar"/>
|
<property name="jar.dir" value="${build.dir}/jar"/>
|
||||||
<property name="classes.dir" value="${build.dir}/classes"/>
|
<property name="classes.dir" value="${build.dir}/classes"/>
|
||||||
|
<property name="lib.dir" value="lib"/>
|
||||||
|
|
||||||
<property name="main-class" value="hbb.HelloWorld"/>
|
<property name="main-class" value="hbb.HelloWorld"/>
|
||||||
|
|
||||||
|
<path id="classpath">
|
||||||
|
<fileset dir="${lib.dir}" includes="**/*.jar"/>
|
||||||
|
</path>
|
||||||
|
<path id="application" location="${jar.dir}/${ant.project.name}.jar"/>
|
||||||
|
|
||||||
<target name="clean">
|
<target name="clean">
|
||||||
<delete dir="${build.dir}"/>
|
<delete dir="${build.dir}"/>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="compile">
|
<target name="compile">
|
||||||
<mkdir dir="${classes.dir}"/>
|
<mkdir dir="${classes.dir}"/>
|
||||||
<javac srcdir="src" destdir="${classes.dir}"/>
|
<javac srcdir="src" destdir="${classes.dir}" classpathref="classpath"/>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="jar" depends="compile">
|
<target name="jar" depends="compile">
|
||||||
|
@ -27,7 +33,24 @@
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="run" depends="jar">
|
<target name="run" depends="jar">
|
||||||
<java jar="${jar.dir}/HelloWorld.jar" fork="true"/>
|
<java fork="true" classname="${main-class}">
|
||||||
|
<classpath>
|
||||||
|
<path refid="classpath"/>
|
||||||
|
<path location="${jar.dir}/${ant.project.name}.jar"/>
|
||||||
|
</classpath>
|
||||||
|
</java>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="junit" depends="jar">
|
||||||
|
<junit printsummary="yes">
|
||||||
|
<classpath>
|
||||||
|
<path refid="classpath"/>
|
||||||
|
<path refid="application"/>
|
||||||
|
</classpath>
|
||||||
|
<batchtest fork="yes">
|
||||||
|
<fileset dir="${src.dir}" includes="**/*Test.java"/>
|
||||||
|
</batchtest>
|
||||||
|
</junit>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="clean-build" depends="clean,jar"/>
|
<target name="clean-build" depends="clean,jar"/>
|
||||||
|
|
0
lib/.gitkeep
Normal file
0
lib/.gitkeep
Normal file
BIN
lib/junit-4.13.2.jar
Normal file
BIN
lib/junit-4.13.2.jar
Normal file
Binary file not shown.
18
src/hbb/HelloWorldTest.java
Normal file
18
src/hbb/HelloWorldTest.java
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
package hbb;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import static org.junit.Assert.fail;
|
||||||
|
|
||||||
|
public class HelloWorldTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testNothing() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testWillAlwaysFail() {
|
||||||
|
fail("An error message");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in a new issue