java.lang.Throwable similar to ThrowableAssert but with assertions methods named
differently to make testing code fluent (ex : withMessage instead of hasMessage.
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 ThrowableAssertAlternative | as(Description
the new description to set. description)Overrides org. Overrides default org. |
| public ThrowableAssertAlternative | describedAs(String
the new description to set. description, Object... optional parameter if description is a format String. args)Overrides default org. |
| public ThrowableAssertAlternative | describedAs(Description
the new description to set. description)Overrides org. Implements org. |
| protected ThrowableAssert | |
| public ThrowableAssertAlternative | Returns: a new assertion object with the cause of the current actual becoming the new actualChecks if the actual |
| public ThrowableAssertAlternative | Returns: a new assertion object with the root cause of the current actual becoming the new actualChecks if the actual |
| public ThrowableAssertAlternative | |
| public ThrowableAssertAlternative | Returns: this assertion object.the expected cause type. type)Verifies that the cause of the actual |
| public ThrowableAssertAlternative | Returns: this assertion object.the expected cause type. type)Verifies that the cause of the actual |
| public ThrowableAssertAlternative | Returns: this assertion object.the expected message. message)Verifies that the message of the actual |
| public ThrowableAssertAlternative | Returns: this assertion object.a format string representing the expected message message, Object... argument referenced by the format specifiers in the format string parameters)Verifies that the message of the actual |
| public ThrowableAssertAlternative | Returns: this assertion object.the description expected to be contained in the actual description)Throwable's message.Verifies that the message of the actual |
| public ThrowableAssertAlternative | Returns: this assertion object.the description expected to be contained in the actual description, Object... Throwable's message.argument referenced by the format specifiers in the format string parameters)Verifies that the message of the actual |
| public ThrowableAssertAlternative | Returns: this assertion object.the Strings expected to be contained in the actual values)Throwable's message.Verifies that the message of the actual |
| public ThrowableAssertAlternative | Returns: this assertion object.the description expected to end the actual description)Throwable's message.Verifies that the message of the actual |
| public ThrowableAssertAlternative | Returns: this assertion object.the description expected to end the actual description, Object... Throwable's message.argument referenced by the format specifiers in the format string parameters)Verifies that the message of the actual |
| public ThrowableAssertAlternative | Returns: this assertion object.the regular expression of value expected to be matched the actual regex)Throwable's message.Verifies that the message of the actual |
| public ThrowableAssertAlternative | Returns: this assertion objectthe content expected to not be contained in the actual content)Throwable's message.Verifies that the message of the actual |
| public ThrowableAssertAlternative | Returns: this assertion objectthe contents expected to not be contained in the actual values)Throwable's message.Verifies that the message of the actual |
| public ThrowableAssertAlternative | Returns: this assertion object.the description expected to start the actual description)Throwable's message.Verifies that the message of the actual |
| public ThrowableAssertAlternative | Returns: this assertion object.the description expected to start the actual description, Object... Throwable's message.argument referenced by the format specifiers in the format string parameters)Verifies that the message of the actual |
| public ThrowableAssertAlternative | Returns: this assertion object.Verifies that the actual |
| public ThrowableAssertAlternative | Returns: this assertion object.the expected cause type. type)Verifies that the root cause of the actual |
| public ThrowableAssertAlternative | Returns: this assertion object.the expected cause type. type)Verifies that the root cause of the actual |
| public ThrowableAssertAlternative | Returns: this assertion object.the description expected to be contained in the actual description)Throwable's stack trace.Verifies that the stack trace of the actual |
| public ThrowableAssertAlternative | Returns: this assertion object.the description expected to be contained in the actual description, Object... Throwable's stack trace.argument referenced by the format specifiers in the format string parameters)Verifies that the stack trace of the actual |
| delegate | back to summary |
|---|---|
| private final ThrowableAssert<ACTUAL> delegate | |
| ThrowableAssertAlternative | back to summary |
|---|---|
| public ThrowableAssertAlternative(final ACTUAL actual) | |
| as | back to summary |
|---|---|
| public ThrowableAssertAlternative 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
| |
| describedAs | back to summary |
|---|---|
| public ThrowableAssertAlternative 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.
Alias for
| |
| describedAs | back to summary |
|---|---|
| public ThrowableAssertAlternative Overrides org. Implements 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 | |
| havingCause | back to summary |
|---|---|
| public ThrowableAssertAlternative Checks if the actual
| |
| havingRootCause | back to summary |
|---|---|
| public ThrowableAssertAlternative Checks if the actual
| |
| withCause | back to summary |
|---|---|
| public ThrowableAssertAlternative Verifies that the actual Example:
| |
| withCauseExactlyInstanceOf | back to summary |
|---|---|
| public ThrowableAssertAlternative Verifies that the cause of the actual Example:
| |
| withCauseInstanceOf | back to summary |
|---|---|
| public ThrowableAssertAlternative Verifies that the cause of the actual Example:
| |
| withMessage | back to summary |
|---|---|
| public ThrowableAssertAlternative Verifies that the message of the actual Examples:
| |
| withMessage | back to summary |
|---|---|
| public ThrowableAssertAlternative Verifies that the message of the actual Examples:
| |
| withMessageContaining | back to summary |
|---|---|
| public ThrowableAssertAlternative Verifies that the message of the actual Examples:
| |
| withMessageContaining | back to summary |
|---|---|
| public ThrowableAssertAlternative Verifies that the message of the actual Examples:
| |
| withMessageContainingAll | back to summary |
|---|---|
| public ThrowableAssertAlternative Verifies that the message of the actual Examples:
| |
| withMessageEndingWith | back to summary |
|---|---|
| public ThrowableAssertAlternative Verifies that the message of the actual Examples:
| |
| withMessageEndingWith | back to summary |
|---|---|
| public ThrowableAssertAlternative Verifies that the message of the actual Examples:
| |
| withMessageMatching | back to summary |
|---|---|
| public ThrowableAssertAlternative Verifies that the message of the actual Examples:
| |
| withMessageNotContaining | back to summary |
|---|---|
| public ThrowableAssertAlternative Verifies that the message of the actual Examples:
| |
| withMessageNotContainingAny | back to summary |
|---|---|
| public ThrowableAssertAlternative Verifies that the message of the actual Examples:
| |
| withMessageStartingWith | back to summary |
|---|---|
| public ThrowableAssertAlternative Verifies that the message of the actual Examples:
| |
| withMessageStartingWith | back to summary |
|---|---|
| public ThrowableAssertAlternative Verifies that the message of the actual Examples:
| |
| withNoCause | back to summary |
|---|---|
| public ThrowableAssertAlternative Verifies that the actual Example:
| |
| withRootCauseExactlyInstanceOf | back to summary |
|---|---|
| public ThrowableAssertAlternative Verifies that the root cause of the actual Example:
| |
| withRootCauseInstanceOf | back to summary |
|---|---|
| public ThrowableAssertAlternative Verifies that the root cause of the actual Example:
| |
| withStackTraceContaining | back to summary |
|---|---|
| public ThrowableAssertAlternative Verifies that the stack trace of the actual Examples:
| |
| withStackTraceContaining | back to summary |
|---|---|
| public ThrowableAssertAlternative Verifies that the stack trace of the actual Examples:
| |