Top Description Methods
io.vertx.core

public Interface Expectation<V>

Known Direct Subinterfaces
io.vertx.core.http.HttpResponseExpectation
Annotations
@FunctionalInterface
Imports
java.util.Objects, java.util.function.BiFunction, .Function, .Predicate

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

Modifier and TypeMethod and Description
public default Expectation<V>

Returns:

an expectation that is a logical and of this and other
and
(Expectation<? super V>
the other expectation
other
)

Returned an expectation succeeding when this expectation and the other expectation succeeds.

public default Throwable

Returns:

a meaningful exception
describe
(V
the value to describe
value
)

Turn an invalid value into an exception describing the failure, the default implementation returns a generic exception.

public default Expectation<V>

Returns:

an expectation that is a logical or of this and other
or
(Expectation<? super V>
the other expectation
other
)

Returned an expectation succeeding when this expectation or the other expectation succeeds.

public boolean
test(V
the checked value
value
)

Check the value, this should be side effect free, the expectation should either succeed returning true or fail returning false.

public default Expectation<V>

Returns:

a new expectation describing the error with descriptor
wrappingFailure
(BiFunction<V, Throwable, Throwable>
the function describing the error
descriptor
)

Returns a new expectation with the same predicate and a customized error descriptor.

Method Detail

andback to summary
public default Expectation<V> and(Expectation<? super V> other)

Returned an expectation succeeding when this expectation and the other expectation succeeds.

Parameters
other:Expectation<? super V>

the other expectation

Returns:Expectation<V>

an expectation that is a logical and of this and other

describeback to summary
public default Throwable describe(V value)

Turn an invalid value into an exception describing the failure, the default implementation returns a generic exception.

Parameters
value:V

the value to describe

Returns:Throwable

a meaningful exception

orback to summary
public default Expectation<V> or(Expectation<? super V> other)

Returned an expectation succeeding when this expectation or the other expectation succeeds.

Parameters
other:Expectation<? super V>

the other expectation

Returns:Expectation<V>

an expectation that is a logical or of this and other

testback to summary
public 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:V

the checked value

wrappingFailureback to summary
public default Expectation<V> wrappingFailure(BiFunction<V, Throwable, Throwable> descriptor)

Returns a new expectation with the same predicate and a customized error descriptor.

Parameters
descriptor:BiFunction<V, Throwable, Throwable>

the function describing the error

Returns:Expectation<V>

a new expectation describing the error with descriptor