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>failuresprivate Expect.TestPhaseinRuleContext
-
Constructor Summary
Constructors Constructor Description ExpectationGatherer()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static voidappendIndented(int countLength, java.lang.StringBuilder builder, java.lang.String toAppend)(package private) voidcheckInRuleContext()private voiddoCheckInRuleContext(java.lang.AssertionError failure)private voiddoLeaveRuleContext()private voiddoLeaveRuleContext(java.lang.Throwable caught)(package private) voidenterRuleContext()voidfail(java.lang.AssertionError failure)Handles a failure.(package private) booleanhasFailures()(package private) voidleaveRuleContext(java.lang.Throwable caught)private java.lang.StringprintSubsequentFailure(java.lang.StackTraceElement[] baseTraceFrames, java.lang.AssertionError toPrint)private voidrecord(java.lang.AssertionError failure)java.lang.StringtoString()
-
-
-
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:FailureStrategyHandles a failure. The parameter is anAssertionErroror 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:
failin 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:
toStringin 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)
-
-