private static class DefaultWebTestClient.DefaultBodyContentSpec extends java.lang.Object implements WebTestClient.BodyContentSpec
Modifier and Type | Field and Description |
---|---|
private boolean |
isEmpty |
private EntityExchangeResult<byte[]> |
result |
Constructor and Description |
---|
DefaultBodyContentSpec(EntityExchangeResult<byte[]> result) |
Modifier and Type | Method and Description |
---|---|
WebTestClient.BodyContentSpec |
consumeWith(java.util.function.Consumer<EntityExchangeResult<byte[]>> consumer)
Assert the response body content with the given
Consumer . |
private java.lang.String |
getBodyAsString() |
EntityExchangeResult<java.lang.Void> |
isEmpty()
Assert the response body is empty and return the exchange result.
|
WebTestClient.BodyContentSpec |
json(java.lang.String json)
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()
Exit the chained API and return an
ExchangeResult with the
raw response content. |
WebTestClient.BodyContentSpec |
xml(java.lang.String expectedXml)
Parse expected and actual response content as XML and assert that
the two are "similar", i.e.
|
XpathAssertions |
xpath(java.lang.String expression,
java.util.Map<java.lang.String,java.lang.String> namespaces,
java.lang.Object... args)
Access to response body assertions with specific namespaces using an
XPath expression to inspect a specific subset of the body.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
xpath
private final EntityExchangeResult<byte[]> result
private final boolean isEmpty
DefaultBodyContentSpec(EntityExchangeResult<byte[]> result)
public EntityExchangeResult<java.lang.Void> isEmpty()
WebTestClient.BodyContentSpec
isEmpty
in interface WebTestClient.BodyContentSpec
public WebTestClient.BodyContentSpec json(java.lang.String json)
WebTestClient.BodyContentSpec
Use of this option requires the JSONassert library on to be on the classpath.
json
in interface WebTestClient.BodyContentSpec
json
- the expected JSON content.public WebTestClient.BodyContentSpec xml(java.lang.String expectedXml)
WebTestClient.BodyContentSpec
Use of this method requires the XMLUnit library on the classpath.
xml
in interface WebTestClient.BodyContentSpec
expectedXml
- the expected JSON content.XmlExpectationsHelper.assertXmlEqual(String, String)
public JsonPathAssertions jsonPath(java.lang.String expression, java.lang.Object... args)
WebTestClient.BodyContentSpec
The JSON path expression can be a parameterized string using
formatting specifiers as defined in String.format(java.lang.String, java.lang.Object...)
.
jsonPath
in interface WebTestClient.BodyContentSpec
expression
- the JsonPath expressionargs
- arguments to parameterize the expressionpublic XpathAssertions xpath(java.lang.String expression, @Nullable java.util.Map<java.lang.String,java.lang.String> namespaces, java.lang.Object... args)
WebTestClient.BodyContentSpec
The XPath expression can be a parameterized string using
formatting specifiers as defined in String.format(java.lang.String, java.lang.Object...)
.
xpath
in interface WebTestClient.BodyContentSpec
expression
- the XPath expressionnamespaces
- namespaces to useargs
- arguments to parameterize the expressionprivate java.lang.String getBodyAsString()
public WebTestClient.BodyContentSpec consumeWith(java.util.function.Consumer<EntityExchangeResult<byte[]>> consumer)
WebTestClient.BodyContentSpec
Consumer
.consumeWith
in interface WebTestClient.BodyContentSpec
consumer
- the consumer for the response body; the input
byte[]
may be null
if there was no response body.public EntityExchangeResult<byte[]> returnResult()
WebTestClient.BodyContentSpec
ExchangeResult
with the
raw response content.returnResult
in interface WebTestClient.BodyContentSpec