document assertResourceContains

git-svn-id: https://svn.apache.org/repos/asf/ant/antlibs/antunit/trunk@688096 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Stefan Bodewig 2008-08-22 15:29:46 +00:00
parent 81a6051f78
commit 7d90c2b1a0
2 changed files with 60 additions and 9 deletions

View File

@ -633,6 +633,44 @@
</tr>
</table>
<h2><a name="assertResourceContains">assertResourceContains</a></h2>
<p>Asserts that a resource's content includes a given string.</p>
<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">resource</td>
<td valign="top">Location of the resource to load.</td>
<td valign="top" align="center">Yes</td>
</tr>
<tr>
<td valign="top">value</td>
<td valign="top">The text to search for.</td>
<td valign="top" align="center">Yes</td>
</tr>
<tr>
<td valign="top">casesensitive</td>
<td valign="top">
Perform a case sensitive match.
Default is true.
</td>
<td align="center">No.</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 resource
'<em>resource</em>' to contain value '<em>value</em>' but
was '<em>content of resource</em>'".</td>
<td align="center">No.</td>
</tr>
</table>
<hr/>
</body>
</html>

View File

@ -132,16 +132,29 @@ under the License.
</macrodef>
<macrodef name="assertResourceContains">
<attribute name="resource"/>
<attribute name="value"/>
<attribute name="casesensitive" default="true"/>
<attribute name="message"
default="Expected resource '@{resource}' to contain value '@{value}' but was '${@{resource}}'"/>
<attribute name="resource"/>
<attribute name="value"/>
<attribute name="casesensitive" default="true"/>
<attribute name="message"
default="Expected resource '@{resource}' to contain value '@{value}' but was '${@{resource}}'"/>
<sequential>
<au:assertTrue message="@{message}">
<resourcecontains resource="@{resource}" substring="@{value}"/>
</au:assertTrue>
</sequential>
<au:assertTrue message="@{message}">
<resourcecontains resource="@{resource}" substring="@{value}"/>
</au:assertTrue>
</sequential>
</macrodef>
<macrodef name="assertResourceDoesntContain">
<attribute name="resource"/>
<attribute name="value"/>
<attribute name="casesensitive" default="true"/>
<attribute name="message"
default="Didn't expect resource '@{resource}' to contain value '@{value}' but was '${@{resource}}'"/>
<sequential>
<au:assertFalse message="@{message}">
<resourcecontains resource="@{resource}" substring="@{value}"/>
</au:assertFalse>
</sequential>
</macrodef>
<macrodef name="assertDestIsUptodate" backtrace="false">