Hi, I've got a simple test case in /build directory that I'm trying to compile and run with Ant. Compilation is fine, but I can't figure out how to run this. The class is:
package money;
import org.junit.*;
import static org.junit.Assert.*;
public class MoneyTest {
@Test
public void testAmount() {
Money m = new Money(20);
System.out.println("AMOUNT: " + m.amount());
System.out.println("DOUBLE AMOUNT: " + m.doubleAmount());
assertEquals(21, m.amount());
}
}
and the buildfile goes like this:
<?xml version="1.0"?>
<project name="Money" default="build-source" basedir=".">
<description>The Money project build file.</description>
<property name="src" location="."/>
<property name="build" location="build"/>
<property name="junit" location="lib/junit-4.8.2.jar"/>
<path id="_classpath">
<pathelement path="${junit}"/>
<pathelement path="${build}"/>
</path>
<target name="prepare">
<mkdir dir="${build}"/>
</target>
<target name="build-source" depends="prepare" description="compile the source ">
<javac srcdir="${src}" destdir="${build}">
<classpath refid="_classpath"/>
</javac>
</target>
<target name="run" depends="build-source">
<java classname="${build}/MoneyTest">
<classpath refid="_classpath"/>
</java>
</target>
</project>
when I run "ant run" from the Terminal, it says that it cannot find the class at that path.
Thanks beforehand!