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.
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 TypeMethodDescriptiondefault Expectation<V> and(Expectation<? super V> other) Returned an expectation succeeding when this expectation and theotherexpectation succeeds.default ThrowableTurn 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.booleanCheck 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 Details
-
test
Check thevalue, this should be side effect free, the expectation should either succeed returningtrueor fail returningfalse.- Parameters:
value- the checked value
-
and
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
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
-
wrappingFailure
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
-