org.junit.rules.RunRules Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of virtdata-lib-curves4 Show documentation
Show all versions of virtdata-lib-curves4 Show documentation
Statistical sampling library for use in virtualdataset libraries, based on apache commons math 4
package org.junit.rules;
import org.junit.runner.Description;
import org.junit.runners.model.Statement;
/**
* Runs a collection of rules on a statement.
*
* @since 4.9
*/
public class RunRules extends Statement {
private final Statement statement;
public RunRules(Statement base, Iterable rules, Description description) {
statement = applyAll(base, rules, description);
}
@Override
public void evaluate() throws Throwable {
statement.evaluate();
}
private static Statement applyAll(Statement result, Iterable rules,
Description description) {
for (TestRule each : rules) {
result = each.apply(result, description);
}
return result;
}
}