public class GuiceRule extends Object implements org.junit.rules.MethodRule
Injector
for tests.
Usage:
public @Rule GuiceRule guice = new GuiceRule(YourGuiceModule.class); @Inject SomeClass someClass;
Modifier and Type | Field and Description |
---|---|
protected static com.google.inject.Stage |
DEFAULT_STAGE
Default Stage PRODUCTION.
|
protected com.google.inject.Injector |
injector |
protected Iterable<? extends com.google.inject.Module> |
modules |
protected com.google.inject.Stage |
stage |
Modifier | Constructor and Description |
---|---|
|
GuiceRule(Class<? extends com.google.inject.Module>... moduleClasses) |
|
GuiceRule(com.google.inject.Module... modules) |
protected |
GuiceRule(com.google.inject.Stage stage,
com.google.inject.Module... modules) |
Modifier and Type | Method and Description |
---|---|
org.junit.runners.model.Statement |
apply(org.junit.runners.model.Statement base,
org.junit.runners.model.FrameworkMethod method,
Object target) |
protected void |
setUpGuice(Object target) |
protected void |
tearDownGuice() |
protected static final com.google.inject.Stage DEFAULT_STAGE
protected final Iterable<? extends com.google.inject.Module> modules
protected final com.google.inject.Stage stage
protected com.google.inject.Injector injector
public GuiceRule(com.google.inject.Module... modules)
protected GuiceRule(com.google.inject.Stage stage, com.google.inject.Module... modules)
@SafeVarargs public GuiceRule(Class<? extends com.google.inject.Module>... moduleClasses)
public org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base, org.junit.runners.model.FrameworkMethod method, Object target)
apply
in interface org.junit.rules.MethodRule
protected void setUpGuice(Object target)
protected void tearDownGuice()
Copyright © 2020 OpenDaylight. All rights reserved.