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 Methods 
      Modifier and Type Method Description
      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 an Expectation into a Uni.
      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 an Expectation into a Uni 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 Detail

      • 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 an Expectation into a Uni.
        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 an Expectation into a Uni 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 type
        R - the extracted element type
        Parameters:
        extractor - the extractor function, often a reference to a getDelegate() method
        expectation - the expectation
        Returns:
        the mapping function