|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.mockrunner.base.WebTestModule com.mockrunner.base.HTMLOutputModule
public abstract class HTMLOutputModule
Base class for modules which produce HTML
code as output. These modules have to implement
getOutput()
. The HTML code is provided
in different formats, e.g. as parsed XML
documents.
Constructor Summary | |
---|---|
HTMLOutputModule(WebMockObjectFactory mockFactory)
|
Method Summary | |
---|---|
abstract java.lang.String |
getOutput()
Returns the output as a string. |
java.io.BufferedReader |
getOutputAsBufferedReader()
Returns the output as a BufferedReader . |
org.jdom.Document |
getOutputAsJDOMDocument()
Parses the output with the NekoHTML parser and returns it as a JDOM XML document. |
org.w3c.dom.Document |
getOutputAsW3CDocument()
Parses the output with the NekoHTML parser and returns it as a W3C XML document. |
java.lang.String |
getOutputAsWellformedXML()
Parses the output with the NekoHTML parser and returns it as fixed, wellformed XML. |
void |
setCaseSensitive(boolean caseSensitive)
Set if verifyOutput(java.lang.String) , verifyOutputContains(java.lang.String)
and verifyOutputRegularExpression(java.lang.String) . |
void |
verifyOutput(java.lang.String expectedOutput)
Verifies the tag output. |
void |
verifyOutputContains(java.lang.String expectedOutput)
Verifies if the output contains the specified data. |
void |
verifyOutputRegularExpression(java.lang.String expression)
Verifies if the output matches the specified regular expression. |
Methods inherited from class com.mockrunner.base.WebTestModule |
---|
addRequestParameter, addRequestParameter, addRequestParameter, getRequestAttribute, getRequestParameter, getSessionAttribute, setRequestAttribute, setSessionAttribute |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public HTMLOutputModule(WebMockObjectFactory mockFactory)
Method Detail |
---|
public abstract java.lang.String getOutput()
public java.io.BufferedReader getOutputAsBufferedReader()
BufferedReader
.
public org.w3c.dom.Document getOutputAsW3CDocument()
NestedApplicationException
if the output is not parsable. NekoHTML is quite good in fixing sloppy
HTML code. If you want to use a different parser configuration,
you can use the method XmlUtil.parse(org.apache.xerces.parsers.DOMParser, java.lang.String)
to parse the string output yourself. Please note that
HTML parsing is not very fast and may slow down
your test suite.
org.w3c.dom.Document
java.lang.RuntimeException
- if a parsing error occurspublic org.jdom.Document getOutputAsJDOMDocument()
NestedApplicationException
if the output is not parsable. NekoHTML is quite good in fixing sloppy
HTML code. If you want to use a different parser configuration,
you can use the method XmlUtil.parse(org.apache.xerces.parsers.DOMParser, java.lang.String)
to parse the string output yourself. Please note that
HTML parsing is not very fast and may slow down
your test suite.
org.jdom.Document
java.lang.RuntimeException
- if a parsing error occurspublic java.lang.String getOutputAsWellformedXML()
NestedApplicationException
if the output is not parsable. NekoHTML is quite good in fixing sloppy
HTML code. If you want to use a different parser configuration,
you can use the method XmlUtil.parse(org.apache.xerces.parsers.DOMParser, java.lang.String)
to parse the string output yourself. Please note that
HTML parsing is not very fast and may slow down
your test suite.
java.lang.RuntimeException
- if a parsing error occurspublic void setCaseSensitive(boolean caseSensitive)
verifyOutput(java.lang.String)
, verifyOutputContains(java.lang.String)
and verifyOutputRegularExpression(java.lang.String)
.
should compare case sensitive. Default is true
.
caseSensitive
- enable or disable case sensitivitypublic void verifyOutput(java.lang.String expectedOutput)
expectedOutput
- the expected output.
VerifyFailedException
- if verification failspublic void verifyOutputContains(java.lang.String expectedOutput)
expectedOutput
- the data
VerifyFailedException
- if verification failspublic void verifyOutputRegularExpression(java.lang.String expression)
expression
- the data
VerifyFailedException
- if verification fails
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |