Class SoftThrowableTypeAssert<T extends java.lang.Throwable>

    • Constructor Detail

      • SoftThrowableTypeAssert

        public SoftThrowableTypeAssert​(java.lang.Class<? extends T> throwableType,
                                       SoftAssertionsProvider softAssertionsProvider)
        Default constructor.
        Parameters:
        throwableType - class representing the target (expected) exception
        softAssertionsProvider - the soft assertion instance used later on to proxy ThrowableAssert
    • Method Detail

      • 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 interface Descriptable<T extends java.lang.Throwable>
        Overrides:
        describedAs in class ThrowableTypeAssert<T extends java.lang.Throwable>
        Parameters:
        description - the new description to set.
        Returns:
        this object.