Class HttpResponseCodeValidator


  • public class HttpResponseCodeValidator
    extends java.lang.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 Detail

      • HttpResponseCodeValidator

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

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

      • validate

        public void validate​(HtmlPage page)
        Validates the specified HTML page.
        Parameters:
        page - the page to check
        Throws:
        java.lang.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:
        java.lang.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​(java.lang.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 java.lang.Object
        Returns:
        true if both validators check for the same response code, false otherwise
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object