ThrowableAssertAlternative subclass used in soft assertions.
Assertion methods for java. similar to ThrowableAssert but with assertions methods named
differently to make testing code fluent (ex : withMessage instead of hasMessage).
SoftAssertions softly = new SoftAssertions();
softly.assertThatExceptionOfType(IOException.class)
.isThrownBy(() -> { throw new IOException("boom! tcha!"); });
.withMessage("boom! %s", "tcha!");
This class is linked with the ThrowableTypeAssert and allow to check that an exception type is thrown by a lambda.
| Modifier and Type | Field and Description |
|---|---|
| private final ThrowableAssert |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public SoftThrowableAssertAlternative | as(Description
the new description to set. description)Overrides org. Overrides default org. |
| protected ThrowableAssert |
| proxiedThrowableAssert | back to summary |
|---|---|
| private final ThrowableAssert<ACTUAL> proxiedThrowableAssert | |
| SoftThrowableAssertAlternative | back to summary |
|---|---|
public SoftThrowableAssertAlternative(final ACTUAL actual, SoftAssertionsProvider softAssertionsProvider)
| |
| as | back to summary |
|---|---|
| public SoftThrowableAssertAlternative Overrides org. Overrides default org. Doc from org. 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
| |
| getDelegate | back to summary |
|---|---|
| protected ThrowableAssert Overrides org.
| |