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 forThrowablesubjects.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.google.common.truth.Subject
Subject.EqualityCheck, Subject.Factory<SubjectT extends Subject,ActualT>
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Throwableactual
-
Constructor Summary
Constructors Modifier Constructor Description protectedThrowableSubject(FailureMetadata metadata, java.lang.Throwable throwable)Constructor for use by subclasses.(package private)ThrowableSubject(FailureMetadata metadata, java.lang.Throwable throwable, java.lang.String typeDescription)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ThrowableSubjecthasCauseThat()Returns a newThrowableSubjectthat supports assertions on this throwable's direct cause.StringSubjecthasMessageThat()Returns aStringSubjectto make assertions about the throwable's message.-
Methods inherited from class com.google.common.truth.Subject
actual, actualCustomStringRepresentation, actualCustomStringRepresentationForPackageMembersToCall, butWas, check, check, checkNoNeedToDisplayBothValues, equals, fail, fail, fail, failEqualityCheckForEqualsWithoutDescription, failWithActual, failWithActual, failWithActual, failWithActual, failWithBadResults, failWithCustomSubject, failWithoutActual, failWithoutActual, failWithoutActual, failWithoutActual, failWithoutSubject, hashCode, ignoreCheck, isAnyOf, isEqualTo, isIn, isInstanceOf, isNoneOf, isNotEqualTo, isNotIn, isNotInstanceOf, isNotNull, isNotSameInstanceAs, isNull, isSameInstanceAs, toString, typeDescription
-
-
-
-
Constructor Detail
-
ThrowableSubject
protected ThrowableSubject(FailureMetadata metadata, java.lang.Throwable throwable)
Constructor for use by subclasses. If you want to create an instance of this class itself, callcheck(...).that(actual).
-
ThrowableSubject
ThrowableSubject(FailureMetadata metadata, java.lang.Throwable throwable, java.lang.String typeDescription)
-
-
Method Detail
-
hasMessageThat
public final StringSubject hasMessageThat()
Returns aStringSubjectto make assertions about the throwable's message.
-
hasCauseThat
public final ThrowableSubject hasCauseThat()
Returns a newThrowableSubjectthat 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.
-
-