Interface ResponseAsserts

All Known Implementing Classes:
AssertableResponse

public interface ResponseAsserts
  • Method Details

    • seeResponseCodeIs

      AssertableResponse seeResponseCodeIs(int statusCode)
      Assert response StatusCode
      Parameters:
      statusCode - expected StatusCode
      Returns:
      this instance for method chaining
      Throws:
      AssertionError - on assert fail
    • seeResponseCodeIsSuccessful

      AssertableResponse seeResponseCodeIsSuccessful()
      Assert response StatusCode should be 2xx
    • seeResponseBodyFieldMatch

      AssertableResponse seeResponseBodyFieldMatch(String path, org.hamcrest.Matcher<?> matcher)
      Assert response Body field match matcher
      Parameters:
      path - path to field (data.user.id)
      matcher - Matcher
      Returns:
      this instance for method chaining
      Throws:
      AssertionError - on assert fail
    • seeResponseHeaderMatch

      AssertableResponse seeResponseHeaderMatch(String header, org.hamcrest.Matcher<?> matcher)
      Assert response header match matcher
      Parameters:
      header - header name
      matcher - Matcher
      Returns:
      this instance for method chaining
      Throws:
      AssertionError - on assert fail
    • seeResponseIsJsonType

      AssertableResponse seeResponseIsJsonType()
      Assert response is Json/JsonArray type
      Returns:
      this instance for method chaining
      Throws:
      AssertionError - on assert fail
    • seeResponseTimeLess

      AssertableResponse seeResponseTimeLess(long timeMs)
      Assert response time less then maximum expected
      Parameters:
      timeMs - maximum expected response time in MS
      Returns:
      this instance for method chaining
      Throws:
      AssertionError - on assert fail
    • seeResponseContainsJsonSubset

      AssertableResponse seeResponseContainsJsonSubset(String expectedBody)
      Json assertion without strict array ordering

      extensible fields and elements in array will be skipped

      Parameters:
      expectedBody - expected part of JSON (arrays can be not ordered and have different count)
      Returns:
      this instance for method chaining
      Throws:
      AssertionError - on assert fail
    • seeResponseContainsJson

      AssertableResponse seeResponseContainsJson(String expectedBody)
      Json assertion without strict array ordering

      extensible fields will be skipped. But extensible elements in array cause AssertionError

      Parameters:
      expectedBody - expected part of JSON (arrays can be not ordered but must have same count of elements)
      Returns:
      this instance for method chaining
      Throws:
      AssertionError - on assert fail
    • seeResponseContainsJson

      AssertableResponse seeResponseContainsJson(Path path)
      Json assertion without strict array ordering

      extensible fields will be skipped

      Parameters:
      path - path to file in resources with expected part of JSON (arrays can be not ordered)
      Returns:
      this instance for method chaining
      Throws:
      AssertionError - on assert fail
      net.bugreaper.core.exceptions.FileReaderException - on read file error
    • seeResponseContainsExtendedJson

      AssertableResponse seeResponseContainsExtendedJson(String expectedSetup)
      Json assertion contains and/or optional checks

      Same behavior as JsonAsserts.assertJsonsExtended(String, String).

      Parameters:
      expectedSetup - expected part of JSON and/or optional checks
      Returns:
      this instance for method chaining
      Throws:
      AssertionError - on assert fail
    • seeResponseExactlyMatchJson

      AssertableResponse seeResponseExactlyMatchJson(String expectedBody)
      Json assertion with strict array ordering

      extensible fields not expected

      Parameters:
      expectedBody - expected full JSON with strict ordered arrays
      Returns:
      this instance for method chaining
      Throws:
      AssertionError - on assert fail
    • seeResponseExactlyMatchJson

      AssertableResponse seeResponseExactlyMatchJson(Path path)
      Json assertion with strict array ordering

      extensible fields not expected

      Parameters:
      path - path to file in resources with expected full JSON with strict ordered arrays
      Returns:
      this instance for method chaining
      Throws:
      AssertionError - on assert fail
      net.bugreaper.core.exceptions.FileReaderException - on read file error
    • seeResponseContainsJsonStrictOrder

      AssertableResponse seeResponseContainsJsonStrictOrder(String expectedBody)
      Json assertion with strict array ordering

      extensible fields will be skipped

      Parameters:
      expectedBody - expected part of JSON with strict ordered arrays
      Returns:
      this instance for method chaining
      Throws:
      AssertionError - on assert fail
    • seeResponseExactlyMatchJsonIgnoringOrder

      AssertableResponse seeResponseExactlyMatchJsonIgnoringOrder(String expectedBody)
      Json assertion without strict array ordering

      extensible fields not expected

      Parameters:
      expectedBody - expected full JSON with arrays (can be not ordered)
      Throws:
      AssertionError - on assert fail
    • seeResponseMatchesJsonSchema

      AssertableResponse seeResponseMatchesJsonSchema(Path path)
      Validate that the response matches the JSON schema
      Parameters:
      path - path to file in resources with Json schema
      Returns:
      this instance for method chaining
      Throws:
      AssertionError - on assert fail
      net.bugreaper.core.exceptions.FileReaderException - on read file error
    • seeResponseMatchesXmlSchema

      AssertableResponse seeResponseMatchesXmlSchema(Path path)
      Validate that the response matches the XML schema
      Parameters:
      path - path to file in resources with XML schema
      Returns:
      this instance for method chaining
      Throws:
      AssertionError - on assert fail
      net.bugreaper.core.exceptions.FileReaderException - on read file error
    • seeResponseBodyElementsCount

      AssertableResponse seeResponseBodyElementsCount(int expectedCount)
      Assert that response body(JsonArray) has exactly count elements
      Parameters:
      expectedCount - expected count of elements
      Returns:
      this instance for method chaining
      Throws:
      AssertionError - on assert fail