Class RuleMemberValidator

java.lang.Object
org.junit.internal.runners.rules.RuleMemberValidator

public class RuleMemberValidator extends Object
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.

  • Field Details

    • CLASS_RULE_VALIDATOR

      public static final RuleMemberValidator CLASS_RULE_VALIDATOR
      Validates fields with a ClassRule annotation.
    • RULE_VALIDATOR

      public static final RuleMemberValidator RULE_VALIDATOR
      Validates fields with a Rule annotation.
    • CLASS_RULE_METHOD_VALIDATOR

      public static final RuleMemberValidator CLASS_RULE_METHOD_VALIDATOR
      Validates methods with a ClassRule annotation.
    • RULE_METHOD_VALIDATOR

      public static final RuleMemberValidator RULE_METHOD_VALIDATOR
      Validates methods with a Rule annotation.
  • Method Details

    • validate

      public void validate(TestClass target, List<Throwable> errors)
      Validate the TestClass and adds reasons for rejecting the class to a list of errors.
      Parameters:
      target - the TestClass to validate.
      errors - the list of errors.