Package org.assertj.core.api
Class SoftThrowableTypeAssert<T extends java.lang.Throwable>
- java.lang.Object
-
- org.assertj.core.api.ThrowableTypeAssert<T>
-
- org.assertj.core.api.SoftThrowableTypeAssert<T>
-
- All Implemented Interfaces:
Descriptable<ThrowableTypeAssert<T>>
public class SoftThrowableTypeAssert<T extends java.lang.Throwable> extends ThrowableTypeAssert<T>
ThrowableTypeAssert for soft assertions.- Since:
- 3.23.0
-
-
Field Summary
Fields Modifier and Type Field Description private SoftAssertionsProvider
softAssertionsProvider
-
Fields inherited from class org.assertj.core.api.ThrowableTypeAssert
description, expectedThrowableType
-
-
Constructor Summary
Constructors Constructor Description SoftThrowableTypeAssert(java.lang.Class<? extends T> throwableType, SoftAssertionsProvider softAssertionsProvider)
Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected ThrowableAssertAlternative<T>
buildThrowableTypeAssert(T throwable)
protected void
checkThrowableType(java.lang.Throwable throwable)
SoftThrowableTypeAssert<T>
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
-
-
-
-
Field Detail
-
softAssertionsProvider
private final SoftAssertionsProvider softAssertionsProvider
-
-
Constructor Detail
-
SoftThrowableTypeAssert
public SoftThrowableTypeAssert(java.lang.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 Detail
-
buildThrowableTypeAssert
protected ThrowableAssertAlternative<T> buildThrowableTypeAssert(T throwable)
- Overrides:
buildThrowableTypeAssert
in classThrowableTypeAssert<T extends java.lang.Throwable>
-
checkThrowableType
protected void checkThrowableType(java.lang.Throwable throwable)
- Overrides:
checkThrowableType
in classThrowableTypeAssert<T extends java.lang.Throwable>
-
describedAs
public SoftThrowableTypeAssert<T> describedAs(Description description)
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 java.lang.Throwable>
- Overrides:
describedAs
in classThrowableTypeAssert<T extends java.lang.Throwable>
- Parameters:
description
- the new description to set.- Returns:
this
object.
-
-