use of org.apache.webbeans.test.component.literals.InstanceTypeLiteralBean in project openwebbeans by apache.
the class TypeLiteralTest method testTypeLiteralInInstance.
@Test
public void testTypeLiteralInInstance() {
startContainer(StringOrder.class, IntegerOrder.class, InstanceTypeLiteralBean.class);
InstanceTypeLiteralBean beaninstance = getInstance(InstanceTypeLiteralBean.class);
Object produce = beaninstance.produce(0);
Assert.assertTrue(produce instanceof Instance);
Instance<IntegerOrder> order = (Instance<IntegerOrder>) produce;
Assert.assertTrue(order.get() instanceof IntegerOrder);
produce = beaninstance.produce(1);
Assert.assertTrue(produce instanceof Instance);
Instance<StringOrder> order2 = (Instance<StringOrder>) produce;
Assert.assertTrue(order2.get() instanceof StringOrder);
}
Aggregations