public static interface WebTestClient.BodyContentSpec
Modifier and Type | Method and Description |
---|---|
WebTestClient.BodyContentSpec |
consumeAsStringWith(java.util.function.Consumer<java.lang.String> consumer)
Assert the response body content converted to a String with the given
Consumer . |
WebTestClient.BodyContentSpec |
consumeWith(java.util.function.Consumer<byte[]> consumer)
Assert the response body content with the given
Consumer . |
EntityExchangeResult<java.lang.Void> |
isEmpty()
Assert the response body is empty and return the exchange result.
|
WebTestClient.BodyContentSpec |
json(java.lang.String expectedJson)
Parse the expected and actual response content as JSON and perform a
"lenient" comparison verifying the same attribute-value pairs.
|
JsonPathAssertions |
jsonPath(java.lang.String expression,
java.lang.Object... args)
Access to response body assertions using a
JsonPath expression
to inspect a specific subset of the body.
|
EntityExchangeResult<byte[]> |
returnResult()
Return the exchange result with body content as
byte[] . |
EntityExchangeResult<java.lang.Void> isEmpty()
WebTestClient.BodyContentSpec json(java.lang.String expectedJson)
Use of this option requires the JSONassert library on to be on the classpath.
expectedJson
- the expected JSON content.JsonPathAssertions jsonPath(java.lang.String expression, java.lang.Object... args)
The JSON path expression can be a parameterized string using
formatting specifiers as defined in String.format(java.lang.String, java.lang.Object...)
.
expression
- the JsonPath expressionargs
- arguments to parameterize the expressionWebTestClient.BodyContentSpec consumeAsStringWith(java.util.function.Consumer<java.lang.String> consumer)
Consumer
. The String is created with the Charset
from
the "content-type" response header or UTF-8
otherwise.consumer
- the consumer for the response body; the input String
may be null
if there was no response body.WebTestClient.BodyContentSpec consumeWith(java.util.function.Consumer<byte[]> consumer)
Consumer
.consumer
- the consumer for the response body; the input
byte[]
may be null
if there was no response body.EntityExchangeResult<byte[]> returnResult()
byte[]
.