public class ThrowableAssert extends AbstractAssert<ThrowableAssert,java.lang.Throwable>
Throwable
s.
To create a new instance of this class, invoke
.
Assertions.assertThat(Throwable)
actual, myself
Modifier | Constructor and Description |
---|---|
protected |
ThrowableAssert(java.lang.Throwable actual) |
Modifier and Type | Method and Description |
---|---|
ThrowableAssert |
hasMessage(java.lang.String message)
Verifies that the message of the actual
Throwable is equal to the given one. |
ThrowableAssert |
hasMessageContaining(java.lang.String description)
Verifies that the message of the actual
Throwable contains with the given description. |
ThrowableAssert |
hasMessageEndingWith(java.lang.String description)
Verifies that the message of the actual
Throwable ends with the given description. |
ThrowableAssert |
hasMessageStartingWith(java.lang.String description)
Verifies that the message of the actual
Throwable starts with the given description. |
ThrowableAssert |
hasNoCause()
Verifies that the actual
Throwable does not have a cause. |
as, as, describedAs, describedAs, descriptionText, doesNotHave, doesNotHaveSameClassAs, equals, getWritableAssertionInfo, has, hashCode, hasSameClassAs, is, isEqualTo, isExactlyInstanceOf, isIn, isIn, isInstanceOf, isInstanceOfAny, isNot, isNotEqualTo, isNotExactlyInstanceOf, isNotIn, isNotIn, isNotInstanceOf, isNotInstanceOfAny, isNotNull, isNotOfAnyClassIn, isNotSameAs, isNull, isOfAnyClassIn, isSameAs, overridingErrorMessage, usingComparator, usingDefaultComparator
public ThrowableAssert hasMessage(java.lang.String message)
Throwable
is equal to the given one.message
- the expected message.java.lang.AssertionError
- if the actual Throwable
is null
.java.lang.AssertionError
- if the message of the actual Throwable
is not equal to the given one.public ThrowableAssert hasNoCause()
Throwable
does not have a cause.java.lang.AssertionError
- if the actual Throwable
is null
.java.lang.AssertionError
- if the actual Throwable
has a cause.public ThrowableAssert hasMessageStartingWith(java.lang.String description)
Throwable
starts with the given description.description
- the description expected to start the actual Throwable
's message.java.lang.AssertionError
- if the actual Throwable
is null
.java.lang.AssertionError
- if the message of the actual Throwable
does not start with the given description.public ThrowableAssert hasMessageContaining(java.lang.String description)
Throwable
contains with the given description.description
- the description expected to be contained in the actual Throwable
's message.java.lang.AssertionError
- if the actual Throwable
is null
.java.lang.AssertionError
- if the message of the actual Throwable
does not contain the given description.public ThrowableAssert hasMessageEndingWith(java.lang.String description)
Throwable
ends with the given description.description
- the description expected to end the actual Throwable
's message.java.lang.AssertionError
- if the actual Throwable
is null
.java.lang.AssertionError
- if the message of the actual Throwable
does not end with the given description.Copyright © 2007–2018. All rights reserved.