|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectwebapplicationtestcase.WebApplicationAssertions
public class WebApplicationAssertions
This class provides assertions.
| Constructor Summary | |
|---|---|
WebApplicationAssertions()
|
|
| Method Summary | |
|---|---|
static void |
assertNoTag(HttpResponse httpResponse,
java.lang.String tagName,
java.util.Map attributes,
java.lang.String text)
Asserts there is *not* a tag/node in the content that meets all of the given conditions. |
static void |
assertRedirectedToAction(HttpResponse httpResponse,
java.lang.String webApplicationPath,
java.lang.String action)
Asserts the response was a redirect to the specified action. |
static void |
assertResponse_Error(HttpResponse httpResponse)
Evaluates the http status is an error (500-599). |
static void |
assertResponse_Missing(HttpResponse httpResponse)
Evaluates the http status is missing (404). |
static void |
assertResponse_Redirect(HttpResponse httpResponse)
Evaluates the http status is a redirect (300-399). |
static void |
assertResponse_Success(HttpResponse httpResponse)
Evaluates the http status is success (200). |
static void |
assertResponse(HttpResponse httpResponse,
int expected)
Evaluates the status of the HttpResponse. |
static void |
assertTag(HttpResponse httpResponse,
java.lang.String tagName,
java.util.Map attributes,
java.lang.String text)
Asserts there is a tag/node in the content that meets all of the given conditions. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public WebApplicationAssertions()
| Method Detail |
|---|
public static void assertResponse_Success(HttpResponse httpResponse)
httpResponse - the HttpResponse to evaluate.public static void assertResponse_Redirect(HttpResponse httpResponse)
httpResponse - the HttpResponse to evaluate.public static void assertResponse_Missing(HttpResponse httpResponse)
httpResponse - the HttpResponse to evaluate.public static void assertResponse_Error(HttpResponse httpResponse)
httpResponse - the HttpResponse to evaluate.
public static void assertResponse(HttpResponse httpResponse,
int expected)
HttpResponse.
httpResponse - the HttpResponse to evaluate.expected - the expected status
public static void assertTag(HttpResponse httpResponse,
java.lang.String tagName,
java.util.Map attributes,
java.lang.String text)
assertTag("span", null, null); - Ensures there is at least one <span> in the response; the attributes and text will not be evaluated.assertTag("span", new HashMap(), null); - Ensures there is at least one <span> in the response, which does not have *any* attributes; the text will not be evaluated.assertTag("span", {"id"=>"errorMessage"}, null); - Ensures there is a <span id="errorMessage"> in the response; the text is not evaluated.assertTag("span", {"id"=>"errorMessage"}, "Please check your credentials"); - Ensures this is in the response: <span id="errorMessage">Please check your credentials</span>assertTag(null, {"id"=>"errorMessage"}, null); - Ensures a tag in the response has the 'id' attribute with a value of 'errorMessage', the tag could be anything, 'a', 'p', 'span', 'div'
httpResponse - The response to evaluatetagName - The name of the tag to find, e.g. div, span, aattributes - Attributes of the tag to find, e.g. id="errorMessage" or href="login.html"text - The text to find in the content.
public static void assertNoTag(HttpResponse httpResponse,
java.lang.String tagName,
java.util.Map attributes,
java.lang.String text)
httpResponse - The response to evaluatetagName - The name of the tag to find, e.g. div, span, aattributes - Attributes of the tag to find, e.g. id="errorMessage" or href="login.html"text - The text to find in the content.assertTag(HttpResponse, String, java.util.Map, String)
public static void assertRedirectedToAction(HttpResponse httpResponse,
java.lang.String webApplicationPath,
java.lang.String action)
httpResponse - The response to evaluatewebApplicationPath - The path of the web application of the redirectaction - The name of the action you are expecting to be redirected to
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||