# AssertTask (ant-antunit API)
declaration: package: org.apache.ant.antunit, class: AssertTask

# Klasse AssertTask

java.lang.Object
org.apache.tools.ant.ProjectComponent
org.apache.tools.ant.taskdefs.condition.ConditionBase
org.apache.ant.antunit.AssertTask

Alle implementierten Schnittstellen:
  `Cloneable`

public class AssertTask extends org.apache.tools.ant.taskdefs.condition.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.

## Feldübersicht

### Von Klasse geerbte Felder org.apache.tools.ant.ProjectComponent

`description, location, project`

## Konstruktorübersicht

Konstruktoren
Konstruktor
Beschreibung
`AssertTask()`

## Methodenübersicht

Modifikator und Typ
Methode
Beschreibung
`void`
`execute()`
`void`
`setMessage(String value)`
Message to use when the assertion fails.

### Von Klasse geerbte Methoden org.apache.tools.ant.taskdefs.condition.ConditionBase

`add, addAnd, addAvailable, addChecksum, addContains, addEquals, addFilesMatch, addHttp, addIsFalse, addIsFileSelected, addIsReference, addIsSet, addIsTrue, addNot, addOr, addOs, addSocket, addUptodate, countConditions, getConditions, getTaskName, setTaskName`

### Von Klasse geerbte Methoden org.apache.tools.ant.ProjectComponent

`clone, getDescription, getLocation, getProject, log, log, setDescription, setLocation, setProject`

### Von Klasse geerbte Methoden Object

`equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Konstruktordetails

### AssertTask

public AssertTask()

## Methodendetails

### setMessage

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

Parameter:
  `value` - message to use when the assertion fails

### execute

public void execute() throws org.apache.tools.ant.BuildException

Löst aus:
  `org.apache.tools.ant.BuildException`