use of org.b3log.latke.ioc.drink.annotation.OddLiteral in project latke by b3log.
the class BottleUnitTest method beforeTest.
@BeforeTest
@SuppressWarnings("unchecked")
public void beforeTest() throws Exception {
System.out.println("before BottleUnitTest");
Latkes.initRuntimeEnv();
Lifecycle.startApplication(drinkPackageClasses);
beanManager = LatkeBeanManagerImpl.getInstance();
// Creates bean by APIs
final Configurator configurator = beanManager.getConfigurator();
configurator.createBean(Mix.class).named("spiritMix").scoped(Singleton.class).qualified(new OddLiteral());
// Validate after bean configuration
configurator.validate();
final LatkeBean<?> wineBottleBean = beanManager.getBean(WineBottle.class);
assertNotNull(wineBottleBean);
wineBottle = (WineBottle) beanManager.getReference(wineBottleBean);
assertNotNull(wineBottle);
final LatkeBean<?> juiceBottleBean = beanManager.getBean(JuiceBottle.class);
assertNotNull(juiceBottleBean);
juiceBottle = (JuiceBottle) beanManager.getReference(juiceBottleBean);
assertNotNull(juiceBottle);
final LatkeBean<?> mixBottleBean = beanManager.getBean(MixBottle.class, new HashSet<Annotation>());
mixBottle = (MixBottle) beanManager.getReference(mixBottleBean);
assertNotNull(mixBottle);
}
Aggregations