Java JUnit Tutorial - JUnit Ant

Suppose here is the test case class.

import org.junit.Test;
import org.junit.Ignore;
import static org.junit.Assert.assertEquals;

public class TestMessageUtil {

   public void testPrintMessage() {  

The following code shows how to integrate the JUnit with ant build tools.

<project name="JunitTest" default="test" basedir=".">
   <property name="testdir" location="test" />
   <property name="srcdir" location="src" />
   <property name="full-compile" value="true" />
   <path id="classpath.base"/>
   <path id="classpath.test">
      <pathelement location="/lib/junit-4.10.jar" />
      <pathelement location="${testdir}" />
      <pathelement location="${srcdir}" />
      <path refid="classpath.base" />
   <target name="clean" >
      <delete verbose="${full-compile}">
         <fileset dir="${testdir}" includes="**/*.class" />
   <target name="compile" depends="clean">
      <javac srcdir="${srcdir}" destdir="${testdir}" 
         <classpath refid="classpath.test"/>
   <target name="test" depends="compile">
         <classpath refid="classpath.test" />
         <formatter type="brief" usefile="false" />
         <test name="TestMessageUtil" />