
Java test helper
"The worst bugs are those that compile without warning."
"The system does not punish. It only compiles the truth."
"The purest release is the one that needs no comment."
"The world will not fall from a mistake - it will fall from indifference to it.”

Module for interaction with API and mock-server
-
Click <HERE> to see features
-
Example => WIKI-LINK
-
Contains sub-module "MockApi"
API
Interactions:
sendGet
sendHead
sendOptions
sendPost
sendPut
sendPatch
sendDelete
Response Asserts:
seeResponseCodeIs
seeResponseCodeIsSuccessful
seeResponseTimeLess
seeResponseBodyFieldMatch
seeResponseHeaderMatch
seeResponseIsJsonType
seeResponseContainsJson
seeResponseExactlyMatchJson
seeResponseContainsJsonStrictOrder
seeResponseExactlyMatchJsonIgnoringOrder
seeResponseMatchesJsonSchema
seeResponseMatchesXmlSchema
seeResponseBodyElementsCount
Get data:
grabResponseHeader
grabResponseBody
grabStringFromResponseByPath
grabDataFromResponseByPath
Configs:
.withContentTypeJson()
.withContentTypeXml()
.withContentType(ContentType)
.withMaxResponseMsAssert(long)
.withoutContentType()
.withLogging(boolean)
.setHeader(String, String)
.setHeaders(Map<String, String>)
.setQueryParams(Map<String, String>)
.setBearerAuth(String)
.setBasicAuth(String, String)
.setNoAuth()
Interactions
sendGet
(String endpoint)
Send GET request
return: AssertableResponse
attach: request/response
sendHead
(String endpoint)
Send HEAD request
return: AssertableResponse
attach: request/response
sendOptions
(String endpoint)
Send OPTIONS request
return: AssertableResponse
attach: request/response
sendPost
(String endpoint)
Send POST request
return: AssertableResponse
attach: request/response
sendPost
(String endpoint, Object body)
Send POST request with body
return: AssertableResponse
attach: request/response
sendPut
(String endpoint)
Send PUT request
return: AssertableResponse
attach: request/response
sendPut
(String endpoint, Object body)
Send PUT request with body
return: AssertableResponse
attach: request/response
sendPatch
(String endpoint, Object body)
Send PATCH request with body
return: AssertableResponse
attach: request/response
sendDelete
(String endpoint)
Send DELETE request
return: AssertableResponse
attach: request/response
sendDelete
(String endpoint, Object body)
Send DELETE request with body
return: AssertableResponse
attach: request/response
Asserts
seeResponseCodeIs
(int statusCode)
Assert response StatusCode
seeResponseCodeIsSuccessful
()
Assert response StatusCode should be 2xx
seeResponseTimeLess
(long timeMs)
Assert response time less then maximum expected
seeResponseBodyFieldMatch
(String path, Matcher matcher)
Assert response Body field match matcher
seeResponseHeaderMatch
(String header, Matcher matcher)
Assert response header match matcher
seeResponseIsJsonType
()
Assert response is Json/JsonArray type
seeResponseContainsJson
(String expectedBody)
Json assertion without strict array ordering (extensible fields will be skipped)
attach: expected Json
seeResponseContainsJson
(Path path)
Json assertion without strict array ordering (extensible fields will be skipped)
attach: expected Json
expected Json in file
seeResponseExactlyMatchJson
(String expectedBody)
Json assertion with strict array ordering (extensible fields not expected)
attach: expected Json
seeResponseExactlyMatchJson
(Path path)
Json assertion with strict array ordering (extensible fields not expected)
attach: expected Json
expected Json in file
seeResponseContainsJsonStrictOrder
(String expectedBody)
Json assertion with strict array ordering (extensible fields will be skipped)
attach: expected Json
seeResponseExactlyMatchJsonIgnoringOrder
(String expectedBody)
Json assertion without strict array ordering (extensible fields not expected)
attach: expected Json
seeResponseMatchesJsonSchema
(Path path)
Validate that the response matches the JSON schema
attach: expected schema
expected schema in file
seeResponseMatchesXmlSchema
(Path path)
Validate that the response matches the XML schema
attach: expected schema
expected schema in file
seeResponseBodyElementsCount
(int expectedCount)
Assert that response body(JsonArray) has exactly count elements
Get Data
grabResponseHeader
(String header)

Grab response header data
attach: result
grabResponseBody
()

Grab response body
attach: body
return String
grabStringFromResponseByPath
(String path)

Grab response body field data (converted to String)
attach: result
return String
grabDataFromResponseByPath
(String path)

Grab response body field data
attach: result
return Object (can be any type)