Search in sources :

Example 16 with Injector

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);
}
Also used : Injector(se.jbee.inject.Injector) Test(org.junit.Test)

Example 17 with Injector

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());
}
Also used : Injector(se.jbee.inject.Injector) Test(org.junit.Test)

Example 18 with Injector

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);
}
Also used : Injector(se.jbee.inject.Injector) Test(org.junit.Test)

Example 19 with Injector

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)));
}
Also used : Injector(se.jbee.inject.Injector)

Example 20 with Injector

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);
}
Also used : Globals(se.jbee.inject.config.Globals) Presets(se.jbee.inject.config.Presets) Injector(se.jbee.inject.Injector) Properties(java.util.Properties) Test(org.junit.Test)

Aggregations

Injector (se.jbee.inject.Injector)44 Test (org.junit.Test)41 Shape (java.awt.Shape)3 Globals (se.jbee.inject.config.Globals)2 Options (se.jbee.inject.config.Options)2 Rectangle (java.awt.Rectangle)1 MouseListener (java.awt.event.MouseListener)1 PathIterator (java.awt.geom.PathIterator)1 Serializable (java.io.Serializable)1 EventListener (java.util.EventListener)1 Properties (java.util.Properties)1 Injectron (se.jbee.inject.Injectron)1 NoResourceForDependency (se.jbee.inject.UnresolvableDependency.NoResourceForDependency)1 Presets (se.jbee.inject.config.Presets)1