public final class ThrowableSubject extends Subject<ThrowableSubject,Throwable>
Throwable
subjects.failureStrategy
Modifier and Type | Method and Description |
---|---|
ThrowableSubject |
hasCauseThat()
Returns a new
ThrowableSubject that supports assertions on this throwable's direct
cause. |
void |
hasMessage(String expected)
Deprecated.
Use
hasMessageThat().isEqualTo(expected) instead. You may also consider
using inexact matching of the message (e.g. hasMessageThat().contains(substring) )
for less brittle tests. |
StringSubject |
hasMessageThat()
Returns a
StringSubject to make assertions about the throwable's message. |
actual, actualAsString, actualCustomStringRepresentation, check, equals, fail, fail, fail, failComparing, failComparing, failWithBadResults, failWithCustomSubject, failWithoutActual, failWithoutSubject, failWithRawMessage, failWithRawMessageAndCause, getDisplaySubject, getSubject, hashCode, ignoreCheck, internalCustomName, isAnyOf, isEqualTo, isIn, isInstanceOf, isNoneOf, isNotEqualTo, isNotIn, isNotInstanceOf, isNotNull, isNotSameAs, isNull, isSameAs, named
@Deprecated public void hasMessage(@Nullable String expected)
hasMessageThat().isEqualTo(expected)
instead. You may also consider
using inexact matching of the message (e.g. hasMessageThat().contains(substring)
)
for less brittle tests.public StringSubject hasMessageThat()
StringSubject
to make assertions about the throwable's message.public ThrowableSubject hasCauseThat()
ThrowableSubject
that supports assertions on this throwable's direct
cause. This method can be invoked repeatedly (e.g. assertThat(e).hasCauseThat().hasCauseThat()....
to assert on a particular indirect cause.Copyright © 2017. All rights reserved.