类 DefaultWebTestClient.DefaultResponseSpec
java.lang.Object
cn.taketoday.test.web.reactive.server.DefaultWebTestClient.DefaultResponseSpec
- 所有已实现的接口:
WebTestClient.ResponseSpec
- 封闭类:
- DefaultWebTestClient
private static class DefaultWebTestClient.DefaultResponseSpec
extends Object
implements WebTestClient.ResponseSpec
-
嵌套类概要
从接口继承的嵌套类/接口 cn.taketoday.test.web.reactive.server.WebTestClient.ResponseSpec
WebTestClient.ResponseSpec.ResponseSpecConsumer -
字段概要
字段修饰符和类型字段说明private final Consumer<EntityExchangeResult<?>>private final ExchangeResultprivate final cn.taketoday.web.reactive.function.client.ClientResponseprivate final Duration -
构造器概要
构造器构造器说明DefaultResponseSpec(ExchangeResult exchangeResult, cn.taketoday.web.reactive.function.client.ClientResponse response, Consumer<EntityExchangeResult<?>> entityResultConsumer, Duration timeout) -
方法概要
修饰符和类型方法说明expectAll(WebTestClient.ResponseSpec.ResponseSpecConsumer... consumers) Apply multiple assertions to a response with the given consumers, with the guarantee that all assertions will be applied even if one or more assertions fails with an exception.Consume and decode the response body tobyte[]and then apply assertions on the raw content (e.g. isEmpty, JSONPath, etc.)<B> WebTestClient.BodySpec<B,?> expectBody(cn.taketoday.core.ParameterizedTypeReference<B> bodyType) Alternative toWebTestClient.ResponseSpec.expectBody(Class)that accepts information about a target type with generics.<B> WebTestClient.BodySpec<B,?> expectBody(Class<B> bodyType) Consume and decode the response body to a single object of type<B>and then apply assertions.<E> WebTestClient.ListBodySpec<E>expectBodyList(cn.taketoday.core.ParameterizedTypeReference<E> elementType) Alternative toWebTestClient.ResponseSpec.expectBodyList(Class)that accepts information about a target type with generics.<E> WebTestClient.ListBodySpec<E>expectBodyList(Class<E> elementType) Consume and decode the response body toList<E>and then apply List-specific assertions.Assertions on the cookies of the response.Assertions on the headers of the response.Assertions on the response status.private <E> WebTestClient.ListBodySpec<E>getListBodySpec(reactor.core.publisher.Flux<E> flux) private <B> EntityExchangeResult<B>initEntityExchangeResult(B body) <T> FluxExchangeResult<T>returnResult(cn.taketoday.core.ParameterizedTypeReference<T> elementTypeRef) Alternative toWebTestClient.ResponseSpec.returnResult(Class)that accepts information about a target type with generics.<T> FluxExchangeResult<T>returnResult(Class<T> elementClass) Exit the chained flow in order to consume the response body externally, e.g. viaStepVerifier.
-
字段详细资料
-
exchangeResult
-
response
private final cn.taketoday.web.reactive.function.client.ClientResponse response -
entityResultConsumer
-
timeout
-
-
构造器详细资料
-
DefaultResponseSpec
DefaultResponseSpec(ExchangeResult exchangeResult, cn.taketoday.web.reactive.function.client.ClientResponse response, Consumer<EntityExchangeResult<?>> entityResultConsumer, Duration timeout)
-
-
方法详细资料
-
expectStatus
从接口复制的说明:WebTestClient.ResponseSpecAssertions on the response status.- 指定者:
expectStatus在接口中WebTestClient.ResponseSpec
-
expectHeader
从接口复制的说明:WebTestClient.ResponseSpecAssertions on the headers of the response.- 指定者:
expectHeader在接口中WebTestClient.ResponseSpec
-
expectCookie
从接口复制的说明:WebTestClient.ResponseSpecAssertions on the cookies of the response.- 指定者:
expectCookie在接口中WebTestClient.ResponseSpec
-
expectBody
从接口复制的说明:WebTestClient.ResponseSpecConsume and decode the response body to a single object of type<B>and then apply assertions.- 指定者:
expectBody在接口中WebTestClient.ResponseSpec- 参数:
bodyType- the expected body type
-
expectBody
public <B> WebTestClient.BodySpec<B,?> expectBody(cn.taketoday.core.ParameterizedTypeReference<B> bodyType) 从接口复制的说明:WebTestClient.ResponseSpecAlternative toWebTestClient.ResponseSpec.expectBody(Class)that accepts information about a target type with generics.- 指定者:
expectBody在接口中WebTestClient.ResponseSpec
-
expectBodyList
从接口复制的说明:WebTestClient.ResponseSpecConsume and decode the response body toList<E>and then apply List-specific assertions.- 指定者:
expectBodyList在接口中WebTestClient.ResponseSpec- 参数:
elementType- the expected List element type
-
expectBodyList
public <E> WebTestClient.ListBodySpec<E> expectBodyList(cn.taketoday.core.ParameterizedTypeReference<E> elementType) 从接口复制的说明:WebTestClient.ResponseSpecAlternative toWebTestClient.ResponseSpec.expectBodyList(Class)that accepts information about a target type with generics.- 指定者:
expectBodyList在接口中WebTestClient.ResponseSpec
-
getListBodySpec
-
expectBody
从接口复制的说明:WebTestClient.ResponseSpecConsume and decode the response body tobyte[]and then apply assertions on the raw content (e.g. isEmpty, JSONPath, etc.)- 指定者:
expectBody在接口中WebTestClient.ResponseSpec
-
initEntityExchangeResult
-
returnResult
从接口复制的说明:WebTestClient.ResponseSpecExit the chained flow in order to consume the response body externally, e.g. viaStepVerifier.Note that when
Void.classis passed in, the response body is consumed and released. If no content is expected, then consider using.expectBody().isEmpty()instead which asserts that there is no content.- 指定者:
returnResult在接口中WebTestClient.ResponseSpec
-
returnResult
public <T> FluxExchangeResult<T> returnResult(cn.taketoday.core.ParameterizedTypeReference<T> elementTypeRef) 从接口复制的说明:WebTestClient.ResponseSpecAlternative toWebTestClient.ResponseSpec.returnResult(Class)that accepts information about a target type with generics.- 指定者:
returnResult在接口中WebTestClient.ResponseSpec
-
expectAll
public WebTestClient.ResponseSpec expectAll(WebTestClient.ResponseSpec.ResponseSpecConsumer... consumers) 从接口复制的说明:WebTestClient.ResponseSpecApply multiple assertions to a response with the given consumers, with the guarantee that all assertions will be applied even if one or more assertions fails with an exception.If a single
ErrororRuntimeExceptionis thrown, it will be rethrown.If multiple exceptions are thrown, this method will throw an
AssertionErrorwhose error message is a summary of all the exceptions. In addition, each exception will be added as a suppressed exception to theAssertionError.This feature is similar to the
SoftAssertionssupport in AssertJ and theassertAll()support in JUnit Jupiter.Example
webTestClient.get().uri("/hello").exchange() .expectAll( responseSpec -> responseSpec.expectStatus().isOk(), responseSpec -> responseSpec.expectBody(String.class).isEqualTo("Hello, World!") );- 指定者:
expectAll在接口中WebTestClient.ResponseSpec- 参数:
consumers- the list ofResponseSpecconsumers
-