Skip to content

Instantly share code, notes, and snippets.

@lauripiispanen
Created January 7, 2013 10:39
Show Gist options
  • Save lauripiispanen/4474031 to your computer and use it in GitHub Desktop.
Save lauripiispanen/4474031 to your computer and use it in GitHub Desktop.
import org.junit.rules.TestRule;
import org.junit.runner.Description;
import org.junit.runners.model.Statement;
public class CompositeTestRule implements TestRule {
private TestRule[] rules;
public CompositeTestRule(TestRule... rules) {
this.rules = rules;
}
public Statement apply(Statement statement, Description description) {
Statement s = statement;
for (TestRule rule: rules) {
s = rule.apply(s, description);
}
return s;
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment