Package org.assertj.core.api
Class SoftThrowableTypeAssert<T extends Throwable>
java.lang.Object
org.assertj.core.api.ThrowableTypeAssert<T>
org.assertj.core.api.SoftThrowableTypeAssert<T>
- All Implemented Interfaces:
Descriptable<ThrowableTypeAssert<T>>
ThrowableTypeAssert for soft assertions.
- Since:
- 3.23.0
-
Field Summary
Fields inherited from class org.assertj.core.api.ThrowableTypeAssert
description, expectedThrowableType
-
Constructor Summary
ConstructorDescriptionSoftThrowableTypeAssert
(Class<? extends T> throwableType, SoftAssertionsProvider softAssertionsProvider) Default constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected ThrowableAssertAlternative
<T> buildThrowableTypeAssert
(T throwable) protected void
checkThrowableType
(Throwable throwable) describedAs
(Description description) Sets the description of the assertion that is going to be called after.Methods inherited from class org.assertj.core.api.ThrowableTypeAssert
isThrownBy
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.assertj.core.api.Descriptable
as, as, as, describedAs, describedAs
-
Constructor Details
-
SoftThrowableTypeAssert
public SoftThrowableTypeAssert(Class<? extends T> throwableType, SoftAssertionsProvider softAssertionsProvider) Default constructor.- Parameters:
throwableType
- class representing the target (expected) exceptionsoftAssertionsProvider
- the soft assertion instance used later on to proxyThrowableAssert
-
-
Method Details
-
buildThrowableTypeAssert
- Overrides:
buildThrowableTypeAssert
in classThrowableTypeAssert<T extends Throwable>
-
checkThrowableType
- Overrides:
checkThrowableType
in classThrowableTypeAssert<T extends Throwable>
-
describedAs
Description copied from class:ThrowableTypeAssert
Sets the description of the assertion that is going to be called after.You must set it before calling the assertion otherwise it is ignored as the failing assertion breaks the chained call by throwing an AssertionError.
This overloaded version of "describedAs" offers more flexibility than the one taking a
String
by allowing users to pass their own implementation of a description. For example, a description that creates its value lazily, only when an assertion failure occurs.- Specified by:
describedAs
in interfaceDescriptable<T extends Throwable>
- Overrides:
describedAs
in classThrowableTypeAssert<T extends Throwable>
- Parameters:
description
- the new description to set.- Returns:
this
object.
-