Date: 2022-07-12
Present:
@SpecVersion(spec = "cdi", version = "2.0")
public class BeanContainerTest extends AbstractTest {
@SuppressWarnings("unchecked")
@Deployment
public static WebArchive createTestArchive() {
return new WebArchiveBuilder().withTestClassPackage(BeanContainerTest.class)
.withClasses(RetentionLiteral.class, TargetLiteral.class).build();
}
@Test
@SpecAssertion(section = BM_RESOLVE_AMBIGUOUS_DEP, id = "a")
public void testAmbiguousDependencyResolved() {
Set<Bean<?>> beans = getCurrentBeanContainer().getBeans(Food.class);
assertEquals(beans.size(), 2);
Bean<?> bean = getCurrentBeanContainer().resolve(beans);
assertNotNull(bean);
assertTrue(bean.isAlternative());
assertTrue(typeSetMatches(bean.getTypes(), Food.class, Soy.class, Object.class));
}
}