Package org.assertj.core.api
Class ThrowableTypeAssert<T extends Throwable>
- java.lang.Object
-
- org.assertj.core.api.ThrowableTypeAssert<T>
-
- Type Parameters:
T- type of throwable to be thrown.
public class ThrowableTypeAssert<T extends Throwable> extends Object
Assertion class checkingThrowabletype.The class itself does not do much, it delegates the work to
ThrowableAssertAlternativeafter callingisThrownBy(ThrowableAssert.ThrowingCallable).
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ThrowableAssertAlternative<T>isThrownBy(ThrowableAssert.ThrowingCallable throwingCallable)Assert that an exception of type T is thrown by thethrowingCallableand allow to chain assertions on the thrown exception.
-
-
-
Method Detail
-
isThrownBy
public ThrowableAssertAlternative<T> isThrownBy(ThrowableAssert.ThrowingCallable throwingCallable)
Assert that an exception of type T is thrown by thethrowingCallableand allow to chain assertions on the thrown exception.Example:
assertThatExceptionOfType(IOException.class).isThrownBy(() -> { throw new IOException("boom!"); }) .withMessage("boom!");- Parameters:
throwingCallable- code throwing the exception of expected type- Returns:
- return a
ThrowableAssertAlternative.
-
-