Package org.junit.rules
Interface MethodRule
-
- All Known Implementing Classes:
TestWatchman
public interface MethodRule
A MethodRule is an alteration in how a test method is run and reported. MultipleMethodRule
s can be applied to a test method. TheStatement
that executes the method is passed to each annotatedRule
in turn, and each may return a substitute or modifiedStatement
, which is passed to the nextRule
, if any. For an example of how this can be useful, seeTestWatchman
.Note that
MethodRule
has been replaced byTestRule
, which has the added benefit of supporting class rules.- Since:
- 4.7
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Statement
apply(Statement base, FrameworkMethod method, java.lang.Object target)
Modifies the method-runningStatement
to implement an additional test-running rule.
-
-
-
Method Detail
-
apply
Statement apply(Statement base, FrameworkMethod method, java.lang.Object target)
Modifies the method-runningStatement
to implement an additional test-running rule.- Parameters:
base
- TheStatement
to be modifiedmethod
- The method to be runtarget
- The object on which the method will be run.- Returns:
- a new statement, which may be the same as
base
, a wrapper aroundbase
, or a completely new Statement.
-
-