use of se.jbee.inject.Injector in project silk by jbee.
the class TestCommandBinds method thatServiceCanBeResolvedWhenHavingJustOneGeneric.
@SuppressWarnings("unchecked")
@Test
public void thatServiceCanBeResolvedWhenHavingJustOneGeneric() {
Injector injector = Bootstrap.injector(CommandBindsModule.class);
@SuppressWarnings("rawtypes") Dependency<Command> dependency = dependency(raw(Command.class).parametized(Integer.class));
Command<Integer> square = injector.resolve(dependency);
assertEquals(9L, square.calc(3).longValue());
}
use of se.jbee.inject.Injector in project silk by jbee.
the class TestBootstrapper method thatBundlesAreNotBootstrappedMultipleTimesEvenWhenTheyAreMutual.
/**
* The assert itself doesn't play such huge role here. we just want to reach this code.
*/
@Test(timeout = 50)
public void thatBundlesAreNotBootstrappedMultipleTimesEvenWhenTheyAreMutual() {
Injector injector = Bootstrap.injector(OneMutualDependentBundle.class);
assertNotNull(injector);
}
use of se.jbee.inject.Injector in project silk by jbee.
the class TestBootstrapper method thatDependencyCyclesAreDetected.
@Test(expected = DependencyCycle.class, timeout = 50)
public void thatDependencyCyclesAreDetected() {
Injector injector = Bootstrap.injector(CyclicBindsModule.class);
Foo foo = injector.resolve(dependency(Foo.class));
fail("foo should not be resolvable but was: " + foo);
}
use of se.jbee.inject.Injector in project silk by jbee.
the class TestBootstrapper method thatDependencyCyclesInCirclesAreDetected.
@Test(expected = DependencyCycle.class, timeout = 50)
public void thatDependencyCyclesInCirclesAreDetected() {
Injector injector = Bootstrap.injector(CircularBindsModule.class);
A a = injector.resolve(dependency(A.class));
fail("A should not be resolvable but was: " + a);
}
use of se.jbee.inject.Injector in project silk by jbee.
the class TestBootstrapper method thatEagerSingeltonsCanBeCreated.
@Test
public void thatEagerSingeltonsCanBeCreated() {
Injector injector = Bootstrap.injector(EagerSingletonsBindsModule.class);
int before = EagerSingletonsBindsModule.eagers;
Bootstrap.eagerSingletons(injector);
assertEquals(before + 1, EagerSingletonsBindsModule.eagers);
}
Aggregations