io.vertx.core

## Interface Expectation<V>

- All Known Subinterfaces:
    HttpResponseExpectation
  Functional Interface:
    This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

      @FunctionalInterface
      public interface Expectation<V>

  An expectation, very much like a predicate with the ability to provide a meaningful description of the failure.

  Expectation can be used with `Future.expecting(Expectation)`.
  Author:
    Julien Viet

- - ### Method Summary

    All Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `default Expectation<V>` | `and(Expectation<? super V> other)` Returned an expectation succeeding when this expectation and the `other` expectation succeeds.
    `default Throwable` | `describe(V value)` Turn an invalid `value` into an exception describing the failure, the default implementation returns a generic exception.
    `default Expectation<V>` | `or(Expectation<? super V> other)` Returned an expectation succeeding when this expectation or the `other` expectation succeeds.
    `boolean` | `test(V value)` Check the `value`, this should be side effect free, the expectation should either succeed returning `true` or fail returning `false`.
    `default Expectation<V>` | `wrappingFailure(java.util.function.BiFunction<V,Throwable,Throwable> descriptor)` Returns a new expectation with the same predicate and a customized error `descriptor`.

- - ### Method Detail

    - #### test

          boolean test(V value)

      Check the `value`, this should be side effect free, the expectation should either succeed returning `true` or fail returning `false`.
      Parameters:
        `value` - the checked value

    - #### and

          default Expectation<V> and(Expectation<? super V> other)

      Returned an expectation succeeding when this expectation and the `other` expectation succeeds.
      Parameters:
        `other` - the other expectation
      Returns:
        an expectation that is a logical and of this and `other`

    - #### or

          default Expectation<V> or(Expectation<? super V> other)

      Returned an expectation succeeding when this expectation or the `other` expectation succeeds.
      Parameters:
        `other` - the other expectation
      Returns:
        an expectation that is a logical or of this and `other`

    - #### describe

          default Throwable describe(V value)

      Turn an invalid `value` into an exception describing the failure, the default implementation returns a generic exception.
      Parameters:
        `value` - the value to describe
      Returns:
        a meaningful exception

    - #### wrappingFailure

          default Expectation<V> wrappingFailure(java.util.function.BiFunction<V,Throwable,Throwable> descriptor)

      Returns a new expectation with the same predicate and a customized error `descriptor`.
      Parameters:
        `descriptor` - the function describing the error
      Returns:
        a new expectation describing the error with `descriptor`

Copyright © 2024 Eclipse. All rights reserved.