org.apache.ant.antunit
Class AssertTask
java.lang.Object
ConditionBase
org.apache.ant.antunit.AssertTask
public class AssertTask
- extends ConditionBase
Exits the active build, giving an additional message if the single
nested condition fails or if there is no condition at all.
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.
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 |
AssertTask
public AssertTask()
setMessage
public void setMessage(java.lang.String value)
- Message to use when the assertion fails.
execute
public void execute()
throws BuildException
- Throws:
BuildException