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>>

public class SoftThrowableTypeAssert<T extends Throwable> extends ThrowableTypeAssert<T>
ThrowableTypeAssert for soft assertions.
Since:
3.23.0
  • Constructor Details

    • SoftThrowableTypeAssert

      public SoftThrowableTypeAssert(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 Details

    • buildThrowableTypeAssert

      protected ThrowableAssertAlternative<T> buildThrowableTypeAssert(T throwable)
      Overrides:
      buildThrowableTypeAssert in class ThrowableTypeAssert<T extends 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 interface Descriptable<T extends Throwable>
      Overrides:
      describedAs in class ThrowableTypeAssert<T extends Throwable>
      Parameters:
      description - the new description to set.
      Returns:
      this object.