Package com.google.common.truth
Class Expect.ExpectationGatherer
- java.lang.Object
-
- com.google.common.truth.Expect.ExpectationGatherer
-
- All Implemented Interfaces:
FailureStrategy
- Enclosing class:
- Expect
private static final class Expect.ExpectationGatherer extends java.lang.Object implements FailureStrategy
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<java.lang.AssertionError>
failures
private Expect.TestPhase
inRuleContext
-
Constructor Summary
Constructors Constructor Description ExpectationGatherer()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static void
appendIndented(int countLength, java.lang.StringBuilder builder, java.lang.String toAppend)
(package private) void
checkInRuleContext()
private void
doCheckInRuleContext(java.lang.AssertionError failure)
private void
doLeaveRuleContext()
private void
doLeaveRuleContext(java.lang.Throwable caught)
(package private) void
enterRuleContext()
void
fail(java.lang.AssertionError failure)
Handles a failure.(package private) boolean
hasFailures()
(package private) void
leaveRuleContext(java.lang.Throwable caught)
private java.lang.String
printSubsequentFailure(java.lang.StackTraceElement[] baseTraceFrames, java.lang.AssertionError toPrint)
private void
record(java.lang.AssertionError failure)
java.lang.String
toString()
-
-
-
Field Detail
-
failures
private final java.util.List<java.lang.AssertionError> failures
-
inRuleContext
private Expect.TestPhase inRuleContext
-
-
Method Detail
-
fail
public void fail(java.lang.AssertionError failure)
Description copied from interface:FailureStrategy
Handles a failure. The parameter is anAssertionError
or subclass thereof, and it contains information about the failure, which may include:- message:
getMessage()
- cause:
getCause()
- actual and expected values:
ComparisonFailure.getActual()
,ComparisonFailure.getExpected()
- stack trace:
Throwable.getStackTrace()
We encourage implementations to record as much of this information as practical in the exceptions they may throw or the other records they may make.
- Specified by:
fail
in interfaceFailureStrategy
- message:
-
enterRuleContext
void enterRuleContext()
-
leaveRuleContext
void leaveRuleContext(java.lang.Throwable caught) throws java.lang.Throwable
- Throws:
java.lang.Throwable
-
checkInRuleContext
void checkInRuleContext()
-
hasFailures
boolean hasFailures()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
appendIndented
private static void appendIndented(int countLength, java.lang.StringBuilder builder, java.lang.String toAppend)
-
printSubsequentFailure
private java.lang.String printSubsequentFailure(java.lang.StackTraceElement[] baseTraceFrames, java.lang.AssertionError toPrint)
-
doCheckInRuleContext
private void doCheckInRuleContext(java.lang.AssertionError failure)
-
doLeaveRuleContext
private void doLeaveRuleContext()
-
doLeaveRuleContext
private void doLeaveRuleContext(java.lang.Throwable caught) throws java.lang.Throwable
- Throws:
java.lang.Throwable
-
record
private void record(java.lang.AssertionError failure)
-
-