Class HttpResponseCodeValidator

java.lang.Object
com.xceptance.xlt.api.validators.HttpResponseCodeValidator

public class HttpResponseCodeValidator extends Object
This class validates response codes and can be used as an instance (constructor) or as a global instance for easy reuse by calling getInstance().
  • Constructor Details

    • HttpResponseCodeValidator

      public HttpResponseCodeValidator(int httpResponseCode)
      Constructor.
      Parameters:
      httpResponseCode - the expected response code
    • HttpResponseCodeValidator

      public HttpResponseCodeValidator()
      Constructor, using 200 as response code for validation.
  • Method Details

    • validate

      public void validate(HtmlPage page)
      Validates the specified HTML page.
      Parameters:
      page - the page to check
      Throws:
      AssertionError - if the page fails validation
    • validate

      public void validate(LightWeightPage page)
      Validates the specified lightweight HTML page.
      Parameters:
      page - the page to check
      Throws:
      AssertionError - if the page fails validation
    • getHttpResponseCode

      public int getHttpResponseCode()
      Returns the set response code.
      Returns:
      the set response code
    • getInstance

      public static HttpResponseCodeValidator getInstance()
      Returns an instance of this class with 200 as the response code against which to validate.
      Returns:
      an instance of HttpResponseCodeValidator with 200 as set response code
    • equals

      public boolean equals(Object obj)
      Checks if this validator is equal to another one. It is equal, when it supports the same response code.
      Overrides:
      equals in class Object
      Returns:
      true if both validators check for the same response code, false otherwise
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object