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

org.junit.rules.RunRules Maven / Gradle / Ivy

Go to download

JUnit is a regression testing framework written by Erich Gamma and Kent Beck. It is used by the developer who implements unit tests in Java.

There is a newer version: 4.13.2
Show newest version
package org.junit.rules;

import org.junit.runner.Description;
import org.junit.runners.model.Statement;

/**
 * Runs a collection of rules on a statement.
 */
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;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy