Class TestRuleAdapter
java.lang.Object
com.carrotsearch.randomizedtesting.rules.TestRuleAdapter
- All Implemented Interfaces:
org.junit.rules.TestRule
- Direct Known Subclasses:
RequireAssertionsRule
An abstract
TestRule 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.-
Constructor Summary
Constructors -
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.org.junit.runners.model.Statementapply(org.junit.runners.model.Statement s, org.junit.runner.Description d) protected voidbefore()Always called before the delegateStatement.
-
Constructor Details
-
TestRuleAdapter
public TestRuleAdapter()
-
-
Method Details
-
apply
public org.junit.runners.model.Statement apply(org.junit.runners.model.Statement s, org.junit.runner.Description d) - Specified by:
applyin interfaceorg.junit.rules.TestRule
-
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
-