Package 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 withFuture.expecting(Expectation).- Author:
- Julien Viet
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default Expectation<V>and(Expectation<? super V> other)Returned an expectation succeeding when this expectation and theotherexpectation succeeds.default Throwabledescribe(V value)Turn an invalidvalueinto 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 theotherexpectation succeeds.booleantest(V value)Check thevalue, this should be side effect free, the expectation should either succeed returningtrueor fail returningfalse.default Expectation<V>wrappingFailure(BiFunction<V,Throwable,Throwable> descriptor)Returns a new expectation with the same predicate and a customized errordescriptor.
-
-
-
Method Detail
-
test
boolean test(V value)
Check thevalue, this should be side effect free, the expectation should either succeed returningtrueor fail returningfalse.- Parameters:
value- the checked value
-
and
default Expectation<V> and(Expectation<? super V> other)
Returned an expectation succeeding when this expectation and theotherexpectation 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 theotherexpectation 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 invalidvalueinto 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(BiFunction<V,Throwable,Throwable> descriptor)
Returns a new expectation with the same predicate and a customized errordescriptor.- Parameters:
descriptor- the function describing the error- Returns:
- a new expectation describing the error with
descriptor
-
-