use of se.jbee.inject.config.Presets in project silk by jbee.
the class TestExample1Binds method constructorArgumentsCanBePassedToBootstrappingUsingPresets.
@Test
public void constructorArgumentsCanBePassedToBootstrappingUsingPresets() {
Properties props = new Properties();
props.put("x", "abc");
props.put("y", 12);
Presets presets = Presets.EMPTY.preset(Properties.class, props);
Globals globals = Globals.STANDARD.presets(presets);
Injector injector = Bootstrap.injector(Example1Module1.class, globals);
MyClass obj = injector.resolve(Dependency.dependency(MyClass.class));
assertEquals(12, obj.twelve);
assertEquals("abc", obj.abc);
}
use of se.jbee.inject.config.Presets in project silk by jbee.
the class TestPresetModuleBinds method injector.
private static Injector injector() {
Presets presets = Presets.EMPTY.preset(Properties.class, exampleProperties());
presets = presets.preset(Typecast.listTypeOf(String.class), Arrays.asList("a", "b"));
presets = presets.preset(Typecast.listTypeOf(Integer.class), Arrays.asList(1, 2));
return Bootstrap.injector(PresetModuleBindsBundle.class, Globals.STANDARD.presets(presets));
}
Aggregations