Package io.smallrye.mutiny.vertx.core
Interface Expectations
public interface Expectations
Helper methods to turn Vert.x
Expectation
that work on Future
into Uni
that
can be used in a pipeline using the Uni.plug(Function)
operator, as in:
vertx.createHttpClient()
.request(HttpMethod.GET, port, "localhost", "/")
.chain(HttpClientRequest::send)
.plug(expectation(HttpClientResponse::getDelegate, status(200).and(contentType("text/plain"))))
.onItem().transformToUni(HttpClientResponse::body)
-
Method Summary
Static MethodsModifier and TypeMethodDescriptionstatic <T> Function<io.smallrye.mutiny.Uni<T>,
io.smallrye.mutiny.Uni<T>> expectation
(io.vertx.core.Expectation<? super T> expectation) Yields a function to turn anExpectation
into aUni
.static <T,
R> Function<io.smallrye.mutiny.Uni<T>, io.smallrye.mutiny.Uni<T>> expectation
(Function<T, R> extractor, io.vertx.core.Expectation<? super R> expectation) Yields a function to turn anExpectation
into aUni
and uses an extractor so that expectations work on the correct types (e.g.,HttpResponseHead
) instead of the Mutiny shim types (e.g.,HttpResponseHead
).
-
Method Details
-
expectation
static <T> Function<io.smallrye.mutiny.Uni<T>,io.smallrye.mutiny.Uni<T>> expectation(io.vertx.core.Expectation<? super T> expectation) Yields a function to turn anExpectation
into aUni
.- Type Parameters:
T
- the element type- Parameters:
expectation
- the expectation- Returns:
- the mapping function
-
expectation
static <T,R> Function<io.smallrye.mutiny.Uni<T>,io.smallrye.mutiny.Uni<T>> expectation(Function<T, R> extractor, io.vertx.core.Expectation<? super R> expectation) Yields a function to turn anExpectation
into aUni
and uses an extractor so that expectations work on the correct types (e.g.,HttpResponseHead
) instead of the Mutiny shim types (e.g.,HttpResponseHead
).- Type Parameters:
T
- the element typeR
- the extracted element type- Parameters:
extractor
- the extractor function, often a reference to agetDelegate()
methodexpectation
- the expectation- Returns:
- the mapping function
-