public class LifecycleTester
extends org.junit.rules.ExternalResource
public class MyUnitTest {
@Rule
public LifecycleTester tester = new LifecycleTester(new MyTestSuite());
@Test
public void test() {
// Test specific setup
tester.builder().
withAdditionalModule(new TheModuleImTesting());
// Creates the injector and start LifecycleManager
tester.start();
// Your test code goes here
} // On termination the LifecycleTester will shutdown LifecycleManager
}
public static class| Constructor and Description |
|---|
LifecycleTester(com.netflix.governator.guice.BootstrapModule... suites) |
LifecycleTester(java.lang.Class bootstrap,
com.netflix.governator.guice.BootstrapModule... suites) |
LifecycleTester(java.util.List<com.netflix.governator.guice.BootstrapModule> suites) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
after()
Override to tear down your specific external resource.
|
com.netflix.governator.guice.LifecycleInjectorBuilder |
builder() |
<T> T |
getInstance(java.lang.Class<T> type) |
<T> T |
getInstance(com.google.inject.Key<T> type) |
<T> T |
getInstance(com.google.inject.TypeLiteral<T> type) |
com.google.inject.Injector |
start() |
LifecycleTester |
withBootstrapModule(com.netflix.governator.guice.BootstrapModule bootstrapModule) |
LifecycleTester |
withExternalBindings(com.google.inject.Module module) |
public LifecycleTester(java.util.List<com.netflix.governator.guice.BootstrapModule> suites)
public LifecycleTester(com.netflix.governator.guice.BootstrapModule... suites)
public LifecycleTester(java.lang.Class bootstrap,
com.netflix.governator.guice.BootstrapModule... suites)
public com.google.inject.Injector start()
public LifecycleTester withBootstrapModule(com.netflix.governator.guice.BootstrapModule bootstrapModule)
public LifecycleTester withExternalBindings(com.google.inject.Module module)
public com.netflix.governator.guice.LifecycleInjectorBuilder builder()
public <T> T getInstance(java.lang.Class<T> type)
public <T> T getInstance(com.google.inject.Key<T> type)
public <T> T getInstance(com.google.inject.TypeLiteral<T> type)
protected void after()
after in class org.junit.rules.ExternalResource