类 FluxExchangeResult<T>
java.lang.Object
cn.taketoday.test.web.reactive.server.ExchangeResult
cn.taketoday.test.web.reactive.server.FluxExchangeResult<T>
- 类型参数:
T- the type of elements in the response body
ExchangeResult variant with the response body decoded as
Flux<T> but not yet consumed.- 从以下版本开始:
- 4.0
- 作者:
- Rossen Stoyanchev
- 另请参阅:
-
字段概要
字段 -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明voidconsumeWith(Consumer<FluxExchangeResult<T>> consumer) Invoke the given consumer withinExchangeResult.assertWithDiagnostics(Runnable)passing"this"instance to it.reactor.core.publisher.Flux<T>Return the response body as aFlux<T>of decoded elements.从类继承的方法 cn.taketoday.test.web.reactive.server.ExchangeResult
assertWithDiagnostics, getMethod, getMockServerResult, getRawStatusCode, getRequestBodyContent, getRequestHeaders, getResponseBodyContent, getResponseCookies, getResponseHeaders, getStatus, getUriTemplate, getUrl, toString
-
字段详细资料
-
body
-
-
构造器详细资料
-
FluxExchangeResult
FluxExchangeResult(ExchangeResult result, reactor.core.publisher.Flux<T> body)
-
-
方法详细资料
-
getResponseBody
Return the response body as aFlux<T>of decoded elements.The response body stream can then be consumed further with the "reactor-test"
StepVerifierand cancelled when enough elements have been consumed from the (possibly infinite) stream:FluxExchangeResult<Person> result = this.client.get() .uri("/persons") .accept(TEXT_EVENT_STREAM) .exchange() .expectStatus().isOk() .expectHeader().contentType(TEXT_EVENT_STREAM) .expectBody(Person.class) .returnResult(); StepVerifier.create(result.getResponseBody()) .expectNext(new Person("Jane"), new Person("Jason")) .expectNextCount(4) .expectNext(new Person("Jay")) .thenCancel() .verify(); -
consumeWith
Invoke the given consumer withinExchangeResult.assertWithDiagnostics(Runnable)passing"this"instance to it. This method allows the following, without leaving theWebTestClientchain of calls:client.get() .uri("/persons") .accept(TEXT_EVENT_STREAM) .exchange() .expectStatus().isOk() .returnResult() .consumeWith(result -> assertThat(...);- 参数:
consumer- the consumer for"this"instance
-