/**
* Setup the various injectors. This is run when the rule triggers so that other rules (such as database or lifecycle) can be ready by the time the injectors are created.
*/
private void setup(){
for ( final Entry<String,Module> service : services.entrySet()) {
final Injector injector=Guice.createInjector(Stage.PRODUCTION,new GuiceDisableModule(),service.getValue());
serviceInjectors.put(service.getKey(),injector);
final Binding<Lifecycle> lifecycleBinding=injector.getExistingBinding(Key.get(Lifecycle.class));
if (lifecycleBinding != null) {
lifecycles.add(injector.getInstance(Lifecycle.class));
}
}
final Injector testInjector=Guice.createInjector(Stage.PRODUCTION,new GuiceDisableModule(),testCaseModule);
testInjector.injectMembers(this);
testInjector.injectMembers(testCaseItself);
}

Example 16

From project components-ness-jackson, under directory /src/test/java/com/nesscomputing/jackson/.