Skip to content

Instantly share code, notes, and snippets.

@nlativy nlativy/
Last active Aug 29, 2015

What would you like to do?
GuiceRule - rule for using Guice in JUnit4 tests
import static;
import org.junit.rules.MethodRule;
import org.junit.runners.model.FrameworkMethod;
import org.junit.runners.model.Statement;
public class GuiceRule implements MethodRule {
private final Module module;
public GuiceRule(Module module) {
this.module = checkNotNull(module);
public Statement apply(final Statement statement,
FrameworkMethod frameworkMethod, final Object target) {
return new Statement() {
@Override public void evaluate() throws Throwable {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.