org.apache.ant.antunit
Class AssertTask

java.lang.Object
  extended by ConditionBase
      extended by org.apache.ant.antunit.AssertTask

public class AssertTask
extends ConditionBase

Exits the active build, giving an additional message if the single nested condition fails.

This one could as well be implemented as

 <macrodef name="assertTrue">
   <attribute name="message" default="Assertion failed"/>
   <element name="assertion" implicit="true"/>
   <sequential>
     <fail message="@{message}">
       <condition>
         <assertion/>
       </condition>
     </fail>
   </sequential>
 </macrodef>
 
but wouldn't be able to throw a specialized exception that way - and the macrodef would nest the exception in yet another BuildException.


Constructor Summary
AssertTask()
           
 
Method Summary
 void execute()
           
 void setMessage(java.lang.String value)
          Message to use when the assertion fails.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AssertTask

public AssertTask()
Method Detail

setMessage

public void setMessage(java.lang.String value)
Message to use when the assertion fails.


execute

public void execute()
             throws BuildException
Throws:
BuildException