of

public static ExpectedException<T> of<T extends Exception>(Class<T> clazz, Predicate<Class<T>> classTest, Predicate<T> exceptionTest, Function<String, String> formatter)(source)

Returns an instance representing an expected exceptional behavior.

Return

the expected exceptional behavior

Parameters

clazz

the type representing the expected exception

classTest

a predicate testing if a given class is of the expected type

exceptionTest

a predicate testing if a given exception is of the expected type

formatter

the formatter

<T>

the type of the expected exception