Package org.junit.internal.runners.rules
Class RuleMemberValidator
java.lang.Object
org.junit.internal.runners.rules.RuleMemberValidator
A RuleMemberValidator validates the rule fields/methods of a
TestClass. All reasons for rejecting the
TestClass are written to a list of errors.
There are four slightly different validators. The CLASS_RULE_VALIDATOR
validates fields with a ClassRule annotation and the
RULE_VALIDATOR validates fields with a Rule annotation.
The CLASS_RULE_METHOD_VALIDATOR
validates methods with a ClassRule annotation and the
RULE_METHOD_VALIDATOR validates methods with a Rule annotation.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classprivate static final classRequires the member's declaring class to be publicprivate static final classRequires the member is a field implementingMethodRuleorTestRuleprivate static final classRequires the member is a field implementingTestRuleprivate static final classRequires the validated member to be non-staticprivate static final classRequires the member to be publicprivate static final classRequires the member to be staticprivate static final classRequire the member to return an implementation ofMethodRuleorTestRuleprivate static final classRequire the member to return an implementation ofTestRule(package private) static interface -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Class<? extends Annotation> static final RuleMemberValidatorValidates methods with aClassRuleannotation.static final RuleMemberValidatorValidates fields with aClassRuleannotation.private final booleanstatic final RuleMemberValidatorValidates methods with aRuleannotation.static final RuleMemberValidatorValidates fields with aRuleannotation.private final List<RuleMemberValidator.RuleValidator> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static RuleMemberValidator.Builderprivate static booleanisMethodRule(FrameworkMember<?> member) private static booleanisRuleType(FrameworkMember<?> member) private static booleanisTestRule(FrameworkMember<?> member) private static RuleMemberValidator.BuildervoidValidate theTestClassand adds reasons for rejecting the class to a list of errors.private voidvalidateMember(FrameworkMember<?> member, List<Throwable> errors)
-
Field Details
-
CLASS_RULE_VALIDATOR
Validates fields with aClassRuleannotation. -
RULE_VALIDATOR
Validates fields with aRuleannotation. -
CLASS_RULE_METHOD_VALIDATOR
Validates methods with aClassRuleannotation. -
RULE_METHOD_VALIDATOR
Validates methods with aRuleannotation. -
annotation
-
methods
private final boolean methods -
validatorStrategies
-
-
Constructor Details
-
RuleMemberValidator
RuleMemberValidator(RuleMemberValidator.Builder builder)
-
-
Method Details
-
validate
Validate theTestClassand adds reasons for rejecting the class to a list of errors.- Parameters:
target- theTestClassto validate.errors- the list of errors.
-
validateMember
-
classRuleValidatorBuilder
-
testRuleValidatorBuilder
-
isRuleType
-
isTestRule
-
isMethodRule
-