Package org.junit.runners
Class RuleContainer
- java.lang.Object
-
- org.junit.runners.RuleContainer
-
class RuleContainer extends java.lang.ObjectData structure for ordering ofTestRule/MethodRuleinstances.- Since:
- 4.13
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classRuleContainer.RuleEntry
-
Field Summary
Fields Modifier and Type Field Description (package private) static java.util.Comparator<RuleContainer.RuleEntry>ENTRY_COMPARATORprivate java.util.List<MethodRule>methodRulesprivate java.util.IdentityHashMap<java.lang.Object,java.lang.Integer>orderValuesprivate java.util.List<TestRule>testRules
-
Constructor Summary
Constructors Constructor Description RuleContainer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(MethodRule methodRule)voidadd(TestRule testRule)Statementapply(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.voidsetOrder(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
-
-