T
- type of throwable to be thrown.public class ThrowableTypeAssert<T extends Throwable> extends Object
Throwable
type.
The class itself does not do much, it delegates the work to ThrowableAssertAlternative
after calling #isThrownBy(ThrowingCallable)
.
Modifier and Type | Method and Description |
---|---|
ThrowableAssertAlternative<T> |
isThrownBy(ThrowableAssert.ThrowingCallable throwingCallable)
Assert that an exception of type T is thrown by the
throwingCallable
and allow to chain assertions on the thrown exception. |
public ThrowableAssertAlternative<T> isThrownBy(ThrowableAssert.ThrowingCallable throwingCallable)
throwingCallable
and allow to chain assertions on the thrown exception.
Example:
assertThatExceptionOfType(IOException.class).isThrownBy(() -> { throw new IOException("boom!"); })
.withMessage("boom!");
throwingCallable
- code throwing the exception of expected typeThrowableAssertAlternative
.Copyright © 2014–2016 AssertJ. All rights reserved.