ExpectedException

public interface ExpectedException<T extends Throwable> implements ExpectedObject<T>(source)

A type representing the expected exceptional behavior in a test.

Author

Dustin Glaser

Parameters

<T>

the type of the expected exception

Functions

Link copied to clipboard
public abstract Object behavior()
Returns an object representing the expected behavior of the test.
Link copied to clipboard
public boolean display()
Link copied to clipboard
public static Expected of(Object behavior)

public static ExpectedObject<T> of<T>(T object, Predicate<T> test)
public static ExpectedObject<T> of<T>(T object, Predicate<T> test, Function<String, String> formatter)
Returns an expected behavior where the expected object is described with the given object.
public static ExpectedException<T> of<T extends Exception>(Class<T> clazz, Predicate<Class<T>> classTest, Predicate<T> exceptionTest, Function<String, String> formatter)
Returns an instance representing an expected exceptional behavior.
Link copied to clipboard
public String string(Stringifier stringifier)
Returns a string representation of the expected behavior using the given stringifier to make the behavior human-readable.
Link copied to clipboard
public abstract boolean test(T exception)
Returns if the given exception is as expected.
public abstract boolean test(Class<T> object)
Returns if the given type is of the expected type.