public static interface WebTestClient.ResponseSpec
Modifier and Type | Method and Description |
---|---|
WebTestClient.BodyContentSpec |
expectBody()
Consume and decode the response body to
byte[] and then apply
assertions on the raw content (e.g. |
<B> WebTestClient.BodySpec<B,?> |
expectBody(java.lang.Class<B> bodyType)
Consume and decode the response body to a single object of type
<B> and then apply assertions. |
<B> WebTestClient.BodySpec<B,?> |
expectBody(ParameterizedTypeReference<B> bodyType)
Alternative to
expectBody(Class) that accepts information
about a target type with generics. |
<E> WebTestClient.ListBodySpec<E> |
expectBodyList(java.lang.Class<E> elementType)
Consume and decode the response body to
List<E> and then apply
List-specific assertions. |
<E> WebTestClient.ListBodySpec<E> |
expectBodyList(ParameterizedTypeReference<E> elementType)
Alternative to
expectBodyList(Class) that accepts information
about a target type with generics. |
HeaderAssertions |
expectHeader()
Assertions on the headers of the response.
|
StatusAssertions |
expectStatus()
Assertions on the response status.
|
<T> FluxExchangeResult<T> |
returnResult(java.lang.Class<T> elementType)
Exit the chained API and consume the response body externally.
|
<T> FluxExchangeResult<T> |
returnResult(ParameterizedTypeReference<T> elementType)
Alternative to
returnResult(Class) that accepts information
about a target type with generics. |
StatusAssertions expectStatus()
HeaderAssertions expectHeader()
<B> WebTestClient.BodySpec<B,?> expectBody(java.lang.Class<B> bodyType)
<B>
and then apply assertions.bodyType
- the expected body type<B> WebTestClient.BodySpec<B,?> expectBody(ParameterizedTypeReference<B> bodyType)
expectBody(Class)
that accepts information
about a target type with generics.<E> WebTestClient.ListBodySpec<E> expectBodyList(java.lang.Class<E> elementType)
List<E>
and then apply
List-specific assertions.elementType
- the expected List element type<E> WebTestClient.ListBodySpec<E> expectBodyList(ParameterizedTypeReference<E> elementType)
expectBodyList(Class)
that accepts information
about a target type with generics.WebTestClient.BodyContentSpec expectBody()
byte[]
and then apply
assertions on the raw content (e.g. isEmpty, JSONPath, etc.)<T> FluxExchangeResult<T> returnResult(java.lang.Class<T> elementType)
StepVerifier
from "reactor-test" to assert the Flux<T>
stream
of decoded objects.
Note: Do not use this option for cases where there
is no content (e.g. 204, 4xx) or you're not interested in the content.
For such cases you can use expectBody().isEmpty()
or
expectBody(Void.class)
which ensures that resources are
released regardless of whether the response has content or not.
<T> FluxExchangeResult<T> returnResult(ParameterizedTypeReference<T> elementType)
returnResult(Class)
that accepts information
about a target type with generics.