Package com.google.common.truth
Class ThrowableSubject
- java.lang.Object
-
- com.google.common.truth.Subject
-
- com.google.common.truth.ThrowableSubject
-
- Direct Known Subclasses:
TruthFailureSubject
public class ThrowableSubject extends Subject
Propositions forThrowable
subjects.- Author:
- Kurt Alfred Kluever
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.google.common.truth.Subject
Subject.Factory<SubjectT extends Subject,ActualT>
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
ThrowableSubject(FailureMetadata metadata, @Nullable java.lang.Throwable throwable)
Constructor for use by subclasses.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ThrowableSubject
hasCauseThat()
Returns a newThrowableSubject
that supports assertions on this throwable's direct cause.StringSubject
hasMessageThat()
Returns aStringSubject
to make assertions about the throwable's message.-
Methods inherited from class com.google.common.truth.Subject
actualCustomStringRepresentation, check, equals, failWithActual, failWithActual, failWithoutActual, hashCode, ignoreCheck, isAnyOf, isEqualTo, isIn, isInstanceOf, isNoneOf, isNotEqualTo, isNotIn, isNotInstanceOf, isNotNull, isNotSameInstanceAs, isNull, isSameInstanceAs, toString
-
-
-
-
Constructor Detail
-
ThrowableSubject
protected ThrowableSubject(FailureMetadata metadata, @Nullable java.lang.Throwable throwable)
Constructor for use by subclasses. If you want to create an instance of this class itself, callcheck(...)
.that(actual)
.
-
-
Method Detail
-
hasMessageThat
public final StringSubject hasMessageThat()
Returns aStringSubject
to make assertions about the throwable's message.
-
hasCauseThat
public final ThrowableSubject hasCauseThat()
Returns a newThrowableSubject
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.
-
-