Package com.google.common.truth
Class FailureMetadata
- java.lang.Object
-
- com.google.common.truth.FailureMetadata
-
public final class FailureMetadata extends Object
An opaque, immutable object containing state from the previous calls in the fluent assertion chain. It appears primarily as a parameter toSubject
constructors (andSubject.Factory
methods), which should pass it to the superclass constructor and not otherwise use or store it. In particular, users should not attempt to callSubject
constructors orSubject.Factory
methods directly. Instead, they should use the appropriate factory method:- If you're writing a test:
Truth.assertAbout(Subject.Factory)
.that(...)
- If you're creating a derived subject from within another subject:
check(...).about(...).that(...)
- If you're testing your subject to verify that assertions fail when they should:
ExpectFailure
(One exception: Implementations of
CustomSubjectBuilder
do directly call constructors, using theirCustomSubjectBuilder.metadata()
method to get an instance to pass to the constructor.) - If you're writing a test: