All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.bechte.junit.runners.validation.RuleValidator Maven / Gradle / Ivy

Go to download

This is a runner implementation that supports context hierarchies in JUnit. For more details please visit: https://github.com/bechte/junit-hierarchicalcontextrunner/wiki

There is a newer version: 4.12.2
Show newest version
package de.bechte.junit.runners.validation;

import org.junit.internal.runners.rules.RuleFieldValidator;
import org.junit.runners.model.TestClass;

import java.util.List;

/**
 * The {@link RuleValidator}s validate methods and fields annotated with @Rule. This validators delegate the validation
 * call to the implementation of the {@link RuleFieldValidator} class. This class also has a validate method but it
 * does not implement the {@link TestClassValidator} interface. Therefore, a simple delegate was created.
 */
public enum RuleValidator implements TestClassValidator {
    CLASS_RULE_VALIDATOR(RuleFieldValidator.CLASS_RULE_VALIDATOR),
    RULE_VALIDATOR(RuleFieldValidator.RULE_VALIDATOR),
    CLASS_RULE_METHOD_VALIDATOR(RuleFieldValidator.CLASS_RULE_METHOD_VALIDATOR),
    RULE_METHOD_VALIDATOR(RuleFieldValidator.RULE_METHOD_VALIDATOR);

    private final RuleFieldValidator validator;

    private RuleValidator(final RuleFieldValidator validator) {
        this.validator = validator;
    }

    public void validate(final TestClass testClass, final List errors) {
        validator.validate(testClass, errors);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy