public class ResponseValidator extends Object
Constructor and Description |
---|
ResponseValidator(Class<?> testClass)
Creates a new ResponseValidator using the default
ResponsesDef resource for the given test class. |
ResponseValidator(Class<?> testClass,
String resourceName)
Creates a new ResponseValidator using the given
ResponsesDef resource for the given test class. |
ResponseValidator(InputStream responses)
Creates a new ResponseValidator using the
ResponsesDef read from the given stream. |
ResponseValidator(Reader responses)
Creates a new ResponseValidator using the
ResponsesDef read from the given stream. |
Modifier and Type | Method and Description |
---|---|
void |
assertBodyValid(String op,
String path,
int statusCode,
String contentType,
String content)
Given a response with the given status code to the given operation on the API resource at the given path, completes
successfully if the response body conforms to its OpenAPI definition.
|
void |
assertHeadersValid(String op,
String path,
int statusCode,
Map<String,String> headers)
Given a response with the given status code to the given operation on the API resource at the given path, completes
successfully if the response headers conform to its OpenAPI definition.
|
boolean |
isWriteOnlyInvalid()
Returns if a response containing a "writeOnly" object property is invalid.
|
ResponseValidator |
notifying(ResponseValidationHandler handler)
Changes the handler for validation condition.
|
String |
toString() |
ResponseValidator |
writeOnlyInvalid(boolean invalid)
Changes if a response containing a "writeOnly" object property is invalid.
|
public ResponseValidator(Class<?> testClass)
ResponsesDef
resource for the given test class.public ResponseValidator(Class<?> testClass, String resourceName)
ResponsesDef
resource for the given test class.public ResponseValidator(InputStream responses)
ResponsesDef
read from the given stream.public ResponseValidator(Reader responses)
ResponsesDef
read from the given stream.public ResponseValidator notifying(ResponseValidationHandler handler)
null
, the default validation
handler (ResponseValidationHandler.EXPECT_CONFORM
) is used.public ResponseValidator writeOnlyInvalid(boolean invalid)
public boolean isWriteOnlyInvalid()
public void assertBodyValid(String op, String path, int statusCode, String contentType, String content)
reports an invalid response condition
.public void assertHeadersValid(String op, String path, int statusCode, Map<String,String> headers)
reports an invalid response condition
headers
- Maps each header name to its valueCopyright © 2024 The Cornutum Project. All rights reserved.