Interface ExpectedException<T extends Throwable>
- Type Parameters:
T- the type of the expected exception
- All Superinterfaces:
Expected,ExpectedObject<Class<T>>
A type representing the expected exceptional behavior in a test.
-
Field Summary
Fields inherited from interface org.tudalgo.algoutils.tutor.general.assertions.expected.Expected
BRACKET_FORMATTER -
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends Exception>
ExpectedException<T>of(Class<T> clazz, Predicate<Class<T>> classTest, Predicate<T> exceptionTest, Function<String, String> formatter) Returns an instance representing an expected exceptional behavior.default Stringstring(Stringifier stringifier) Returns a string representation of the expected behavior using the given stringifier to make the behavior human-readable.booleanReturns if the given type is of the expected type.booleanReturns if the given exception is as expected.
-
Method Details
-
of
static <T extends Exception> ExpectedException<T> of(Class<T> clazz, Predicate<Class<T>> classTest, Predicate<T> exceptionTest, Function<String, String> formatter) Returns an instance representing an expected exceptional behavior.
- Type Parameters:
T- the type of the expected exception- Parameters:
clazz- the type representing the expected exceptionclassTest- a predicate testing if a given class is of the expected typeexceptionTest- a predicate testing if a given exception is of the expected typeformatter- the formatter- Returns:
- the expected exceptional behavior
-
string
Description copied from interface:ExpectedReturns a string representation of the expected behavior using the given stringifier to make the behavior human-readable.
-
test
Returns if the given type is of the expected type.- Specified by:
testin interfaceExpectedObject<T extends Throwable>- Parameters:
object- the type to test- Returns:
- if the given type is of the expected type
-
test
Returns if the given exception is as expected.- Parameters:
exception- the exception to test- Returns:
- if the given exception is of the expected
-