use of se.jbee.inject.Injector in project silk by jbee.
the class TestCollectionBinds method thatCollectionIsAvailableWhenJustListIsInstalled.
@Test
public void thatCollectionIsAvailableWhenJustListIsInstalled() {
Injector injector = Bootstrap.injector(CollectionBindsJustListBundle.class);
Type<? extends Collection<?>> collectionType = collectionTypeOf(Integer.class);
new AssertInjects(injector).assertInjectsItems(new Integer[] { 846, 42 }, collectionType);
}
use of se.jbee.inject.Injector in project silk by jbee.
the class TestDecoratorBinds method test.
@Test
public void test() {
Injector injector = Bootstrap.injector(DecoratorBindsModule.class);
assertEquals(Decorator.class, injector.resolve(Dependency.dependency(Foo.class)).getClass());
}
use of se.jbee.inject.Injector in project silk by jbee.
the class TestDependencyParameterBinds method thatDependencyParameterIsUnderstood.
@Test
public void thatDependencyParameterIsUnderstood() {
Injector resolver = Bootstrap.injector(DependencyParameterBindsBundle.class);
LoggerInspector inspector = resolver.resolve(dependency(LoggerInspector.class));
assertSame(Logger.getLogger(BinderModule.class.getCanonicalName()), inspector.logger);
}
use of se.jbee.inject.Injector in project silk by jbee.
the class TestEditionFeatureBinds method assertEditionInstalls.
private static void assertEditionInstalls(Edition edition, Integer... expected) {
Injector injector = Bootstrap.injector(RootBundle.class, Globals.STANDARD.edition(edition));
assertEqualSets(expected, injector.resolve(dependency(Integer[].class)));
}
use of se.jbee.inject.Injector 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);
}
Aggregations