Class StatementAdapter
java.lang.Object
org.junit.runners.model.Statement
com.carrotsearch.randomizedtesting.rules.StatementAdapter
public abstract class StatementAdapter
extends org.junit.runners.model.Statement
An abstract
Statement that guarantees the execution of
afterAlways(List) even if an exception has been thrown from delegate
Statement. This is much like AfterClass or After
annotations but can be used with RuleChain to guarantee the order of
execution.-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedStatementAdapter(org.junit.runners.model.Statement delegate) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidafterAlways(List<Throwable> errors) Always called after the delegateStatement, even if an exception (or assumption failure) occurs.protected voidCalled only if the delegateStatementreturned successfully.protected voidbefore()Always called before the delegateStatement.final voidevaluate()
-
Field Details
-
delegate
private final org.junit.runners.model.Statement delegate
-
-
Constructor Details
-
StatementAdapter
protected StatementAdapter(org.junit.runners.model.Statement delegate)
-
-
Method Details
-
evaluate
-
before
-
afterAlways
Always called after the delegateStatement, even if an exception (or assumption failure) occurs. Any exceptions thrown from the body of this method will be chained usingMultipleFailureException.- Parameters:
errors- A list of errors received so far. The list is modifiable although should only be extended with new potential exceptions.- Throws:
Throwable
-
afterIfSuccessful
-