org.apache.anteater.test.matchers
Class ContentEquals
java.lang.Object
|
+--org.apache.tools.ant.ProjectComponent
|
+--org.apache.tools.ant.Task
|
+--org.apache.anteater.test.BaseTask
|
+--org.apache.anteater.test.ContentHandlerTask
|
+--org.apache.anteater.test.MatcherTest
|
+--org.apache.anteater.test.matchers.ContentEquals
- All Implemented Interfaces:
- Groupable, ObjectModel, org.apache.tools.ant.TaskContainer
- public class ContentEquals
- extends MatcherTest
Checks if the matchOn
string is equal with another
one. The string to be tested against can be specified either by
inlining it inside the contentEquals
element, or by
specifying a href
attribute that points to the
resource that contains the match:
<contentEquals> text to be matched against</contentEquals>
or
<contentEquals href="some/uri"/>
The ignoreSpaces
boolean flag determines whether whitespace
variations are significant. The default is false
, ie whitespace
is significant. Reasons for set ignoreSpaces
to
true
include:
- The logical content is what's important, eg
foo bar
is equivalent to foo
bar
- The file's linefeed convention is unknown or may change. Eg, DOS uses
\r\n, *nix uses \n and Mac uses \r. Setting
ignoreSpaces
will
ignore these differences.
- The HTTP server or proxy may add trailing whitespace. It seems there's a
bug in Sun's
java.net
implementation which causes Tomcat to do
this.
- Since:
- December 31, 2001
- Version:
- $Revision: 1.18 $ $Date: 2003/02/20 23:52:34 $
- Author:
- Ovidiu Predescu, Costin Manolache, Jeff Turner
Fields inherited from class org.apache.tools.ant.Task |
description, location, target, taskName, taskType, wrapper |
Fields inherited from class org.apache.tools.ant.ProjectComponent |
project |
Methods inherited from class org.apache.tools.ant.Task |
getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, handleErrorOutput, handleOutput, init, isInvalid, log, log, maybeConfigure, perform, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName |
Methods inherited from class org.apache.tools.ant.ProjectComponent |
getProject, setProject |
href
protected String href
- Href to read body text from.
value
protected String value
ignoreSpaces
protected boolean ignoreSpaces
ContentEquals
public ContentEquals()
setHref
public void setHref(String href)
- Location of a resource to test the returned contents for equality against.
- See Also:
BaseTask.resolveContentURL(java.lang.String)
getHref
public String getHref()
- Retrieve the user-specified href.
addText
public void addText(String body)
- Description copied from class:
MatcherTest
- Sets the body text.
- Overrides:
addText
in class MatcherTest
getValue
public String getValue()
toString
public String toString()
- Overrides:
toString
in class Object
setIgnoreSpaces
public void setIgnoreSpaces(boolean ignore)
- Set whether whitespace will be ignored when testing. Useful when
whitespace differences are incidental, eg linefeed differences.
Defaults to
false
, ie whitespace is significant.
validate
public boolean validate()
throws org.apache.tools.ant.BuildException
- Description copied from class:
MatcherTest
- Return true if this instance matches against the
matchOn
object of the matcher
.
- Specified by:
validate
in class MatcherTest
- Returns:
- a
boolean
value
org.apache.tools.ant.BuildException
Ant Functional Tester -- see Project home page for details