| <!-- |
| Licensed to the Apache Software Foundation (ASF) under one or more |
| contributor license agreements. See the NOTICE file distributed with |
| this work for additional information regarding copyright ownership. |
| The ASF licenses this file to You under the Apache License, Version 2.0 |
| (the "License"); you may not use this file except in compliance with |
| the License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
| --> |
| <html> |
| <head> |
| <meta http-equiv="Content-Language" content="en-us"></meta> |
| <link rel="stylesheet" type="text/css" href="style.css"> |
| <title>expectfailure Task</title> |
| </head> |
| |
| <body> |
| <h2><a name="expectfailure">expectfailure</a></h2> |
| |
| <h3>Description</h3> |
| |
| <p>Asserts that at least one of the nested tasks throws a |
| BuildException.</p> |
| |
| <h3>Parameters</h3> |
| <table border="1" cellpadding="2" cellspacing="0"> |
| <tr> |
| <td valign="top"><b>Attribute</b></td> |
| <td valign="top"><b>Description</b></td> |
| <td align="center" valign="top"><b>Required</b></td> |
| </tr> |
| <tr> |
| <td valign="top">message</td> |
| <td valign="top">Message for the exception if the condition |
| doesn't hold true. Defaults to "Expected build failure" if |
| expectedMessage hasn't been specified or "Expected build |
| failure with message '<em>expectedMessage</em>' but was |
| '<em>actualMessage</em>'" if it has been specified and a |
| different exception has been thrown.</td> |
| <td align="center">No.</td> |
| </tr> |
| <tr> |
| <td valign="top">expectedMessage</td> |
| <td valign="top">Used to assert a specific exception message. |
| The string will be looked for (case-sensitive) in the fault string; |
| </td> |
| <td align="center">No.</td> |
| </tr> |
| </table> |
| |
| <h3>Parameters specified as nested elements</h3> |
| <h4>all Ant tasks</h4> |
| |
| <p>You can use all supported tasks and types as nested element of |
| this task.</p> |
| |
| <h3>Examples</h3> |
| |
| <p>Make the build fail with the message "expected build failure |
| with message='failed' but was 'passed'":</p> |
| |
| <pre> |
| <expectfailure expectedMessage="failed"> |
| <fail>passed<fail> |
| </expectfailure> |
| </pre> |
| |
| <p>Make the build fail with the message "expected build failure" |
| because the nested task doesn't cause a build failure:</p> |
| |
| <pre> |
| <expectfailure> |
| <echo>BUILD FAILED</echo> |
| </expectfailure> |
| </pre> |
| |
| <hr/> |
| </body> |
| </html> |