org.junit.rules
Interface MethodRule

All Known Implementing Classes:
ErrorCollector, ExpectedException, ExternalResource, TemporaryFolder, TestName, TestWatchman, Timeout, Verifier

public interface MethodRule

A MethodRule is an alteration in how a test method is run and reported. Multiple MethodRules can be applied to a test method. The Statement that executes the method is passed to each annotated Rule in turn, and each may return a substitute or modified Statement, which is passed to the next Rule, if any. For examples of how this can be useful, see these provided MethodRules, or write your own:


Method Summary
 Statement apply(Statement base, FrameworkMethod method, Object target)
          Modifies the method-running Statement to implement an additional test-running rule.
 

Method Detail

apply

Statement apply(Statement base,
                FrameworkMethod method,
                Object target)
Modifies the method-running Statement to implement an additional test-running rule.

Parameters:
base - The Statement to be modified
method - The method to be run
target - The object on with the method will be run.
Returns:
a new statement, which may be the same as base, a wrapper around base, or a completely new Statement.