Modifier and Type | Class and Description |
---|---|
static interface |
ExpectedFailure.Failable
Implements an action that could throw any type of Throwable, including a checked exception.
|
Constructor and Description |
---|
ExpectedFailure(Class<T> failureType)
Creates a new ExpectedFailure instance.
|
Modifier and Type | Method and Description |
---|---|
static ExpectedFailure<AssertionError> |
expectFailure()
Returns a new ExpectedFailure instance that expects an AssertionError.
|
static <F extends Throwable> |
expectFailure(Class<F> failureType)
Returns a new ExpectedFailure instance.
|
void |
then(Consumer<T> failureChecker)
After
performing an action , apply the given checker to verify details of the expected failure. |
String |
toString() |
ExpectedFailure<T> |
when(ExpectedFailure.Failable action)
Throws an AssertionError if the expected Throwable is not thrown by the given action.
|
ExpectedFailure<T> |
when(ExpectedFailure.Failable action,
Function<Throwable,Throwable> failureMapper)
Throws an AssertionError if the expected Throwable is not thrown by the given action.
|
public ExpectedFailure<T> when(ExpectedFailure.Failable action)
public ExpectedFailure<T> when(ExpectedFailure.Failable action, Function<Throwable,Throwable> failureMapper)
failureMapper
to the
Throwable produced by the action.public void then(Consumer<T> failureChecker)
performing an action
, apply the given checker to verify details of the expected failure.public static <F extends Throwable> ExpectedFailure<F> expectFailure(Class<F> failureType)
public static ExpectedFailure<AssertionError> expectFailure()
Copyright © 2022 The Cornutum Project. All rights reserved.