webapplicationtestcase
Class WebApplicationAssertions

java.lang.Object
  extended by webapplicationtestcase.WebApplicationAssertions

public class WebApplicationAssertions
extends java.lang.Object

This class provides assertions.

Version:
1.0
Author:
Jason Edwards

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

WebApplicationAssertions

public WebApplicationAssertions()
Method Detail

assertResponse_Success

public static void assertResponse_Success(HttpResponse httpResponse)
Evaluates the http status is success (200).

Parameters:
httpResponse - the HttpResponse to evaluate.

assertResponse_Redirect

public static void assertResponse_Redirect(HttpResponse httpResponse)
Evaluates the http status is a redirect (300-399).

Parameters:
httpResponse - the HttpResponse to evaluate.

assertResponse_Missing

public static void assertResponse_Missing(HttpResponse httpResponse)
Evaluates the http status is missing (404).

Parameters:
httpResponse - the HttpResponse to evaluate.

assertResponse_Error

public static void assertResponse_Error(HttpResponse httpResponse)
Evaluates the http status is an error (500-599).

Parameters:
httpResponse - the HttpResponse to evaluate.

assertResponse

public static void assertResponse(HttpResponse httpResponse,
                                  int expected)
Evaluates the status of the HttpResponse.

Parameters:
httpResponse - the HttpResponse to evaluate.
expected - the expected status

assertTag

public 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. All arguments are optional. Here are some examples:

Parameters:
httpResponse - The response to evaluate
tagName - The name of the tag to find, e.g. div, span, a
attributes - Attributes of the tag to find, e.g. id="errorMessage" or href="login.html"
text - The text to find in the content.

assertNoTag

public 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.

Parameters:
httpResponse - The response to evaluate
tagName - The name of the tag to find, e.g. div, span, a
attributes - Attributes of the tag to find, e.g. id="errorMessage" or href="login.html"
text - The text to find in the content.
See Also:
assertTag(HttpResponse, String, java.util.Map, String)

assertRedirectedToAction

public static void assertRedirectedToAction(HttpResponse httpResponse,
                                            java.lang.String webApplicationPath,
                                            java.lang.String action)
Asserts the response was a redirect to the specified action.

Parameters:
httpResponse - The response to evaluate
webApplicationPath - The path of the web application of the redirect
action - The name of the action you are expecting to be redirected to