Package org.junit.runners
Class RuleContainer
- java.lang.Object
-
- org.junit.runners.RuleContainer
-
class RuleContainer extends java.lang.Object
Data structure for ordering ofTestRule
/MethodRule
instances.- Since:
- 4.13
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static class
RuleContainer.RuleEntry
-
Field Summary
Fields Modifier and Type Field Description (package private) static java.util.Comparator<RuleContainer.RuleEntry>
ENTRY_COMPARATOR
private java.util.List<MethodRule>
methodRules
private java.util.IdentityHashMap<java.lang.Object,java.lang.Integer>
orderValues
private java.util.List<TestRule>
testRules
-
Constructor Summary
Constructors Constructor Description RuleContainer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(MethodRule methodRule)
void
add(TestRule testRule)
Statement
apply(FrameworkMethod method, Description description, java.lang.Object target, Statement statement)
Applies all the rules ordered accordingly to the specifiedstatement
.private java.util.List<RuleContainer.RuleEntry>
getSortedEntries()
Returns entries in the order how they should be applied, i.e.(package private) java.util.List<java.lang.Object>
getSortedRules()
Returns rule instances in the order how they should be applied, i.e.void
setOrder(java.lang.Object rule, int order)
Sets order value for the specified rule.
-
-
-
Field Detail
-
orderValues
private final java.util.IdentityHashMap<java.lang.Object,java.lang.Integer> orderValues
-
testRules
private final java.util.List<TestRule> testRules
-
methodRules
private final java.util.List<MethodRule> methodRules
-
ENTRY_COMPARATOR
static final java.util.Comparator<RuleContainer.RuleEntry> ENTRY_COMPARATOR
-
-
Method Detail
-
setOrder
public void setOrder(java.lang.Object rule, int order)
Sets order value for the specified rule.
-
add
public void add(MethodRule methodRule)
-
add
public void add(TestRule testRule)
-
getSortedEntries
private java.util.List<RuleContainer.RuleEntry> getSortedEntries()
Returns entries in the order how they should be applied, i.e. inner-to-outer.
-
apply
public Statement apply(FrameworkMethod method, Description description, java.lang.Object target, Statement statement)
Applies all the rules ordered accordingly to the specifiedstatement
.
-
getSortedRules
java.util.List<java.lang.Object> getSortedRules()
Returns rule instances in the order how they should be applied, i.e. inner-to-outer. VisibleForTesting
-
-