Interface ResponseAsserts
- All Known Implementing Classes:
AssertableResponse
public interface ResponseAsserts
-
Method Summary
Modifier and TypeMethodDescriptionseeResponseBodyElementsCount(int expectedCount) Assert that response body(JsonArray) has exactly count elementsseeResponseBodyFieldMatch(String path, org.hamcrest.Matcher<?> matcher) Assert response Body field match matcherseeResponseCodeIs(int statusCode) Assert response StatusCodeAssert response StatusCode should be 2xxseeResponseContainsExtendedJson(String expectedSetup) Json assertion contains and/or optional checksseeResponseContainsJson(String expectedBody) Json assertion without strict array orderingseeResponseContainsJson(Path path) Json assertion without strict array orderingseeResponseContainsJsonStrictOrder(String expectedBody) Json assertion with strict array orderingseeResponseContainsJsonSubset(String expectedBody) Json assertion without strict array orderingseeResponseExactlyMatchJson(String expectedBody) Json assertion with strict array orderingJson assertion with strict array orderingseeResponseExactlyMatchJsonIgnoringOrder(String expectedBody) Json assertion without strict array orderingseeResponseHeaderMatch(String header, org.hamcrest.Matcher<?> matcher) Assert response header match matcherAssert response is Json/JsonArray typeValidate that the response matches the JSON schemaValidate that the response matches the XML schemaseeResponseTimeLess(long timeMs) Assert response time less then maximum expected
-
Method Details
-
seeResponseCodeIs
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
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
Assert response header match matcher- Parameters:
header- header namematcher- 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
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
Json assertion without strict array orderingextensible 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
Json assertion without strict array orderingextensible 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
Json assertion without strict array orderingextensible 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 failnet.bugreaper.core.exceptions.FileReaderException- on read file error
-
seeResponseContainsExtendedJson
Json assertion contains and/or optional checksSame 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
Json assertion with strict array orderingextensible fields not expected
- Parameters:
expectedBody- expected full JSON with strict ordered arrays- Returns:
- this instance for method chaining
- Throws:
AssertionError- on assert fail
-
seeResponseExactlyMatchJson
Json assertion with strict array orderingextensible 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 failnet.bugreaper.core.exceptions.FileReaderException- on read file error
-
seeResponseContainsJsonStrictOrder
Json assertion with strict array orderingextensible 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
Json assertion without strict array orderingextensible fields not expected
- Parameters:
expectedBody- expected full JSON with arrays (can be not ordered)- Throws:
AssertionError- on assert fail
-
seeResponseMatchesJsonSchema
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 failnet.bugreaper.core.exceptions.FileReaderException- on read file error
-
seeResponseMatchesXmlSchema
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 failnet.bugreaper.core.exceptions.FileReaderException- on read file error
-
seeResponseBodyElementsCount
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
-