EXECUTE: Create a CDI project (w/ CDI support enabled)
EXECUTE: Add the following classes to the project source folder:
package org.jboss; import javax.enterprise.inject.Alternative; @Alternative public class Test { }
package org.jboss; import javax.enterprise.inject.Alternative; @Alternative public class Test1 extends Test { }
package org.jboss; import javax.inject.Inject; public class Test3 { @Inject Test test; }
And beans.xml (should be placed in <source folder>/META-INF/ or <web content>/WEB-INF/ in case of dynamic web project):
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://jboss.org/schema/cdi/beans_1_0.xsd"> <alternatives> <class>org.jboss.Test1</class> </alternatives> </beans>
EXECUTE: Build the project.
ASSERT: There is no CDI problem markers on Test3.test field.
EXECUTE: Replace the beans.xml be the following file:
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://jboss.org/schema/cdi/beans_1_0.xsd"> </beans>
EXECUTE: Save the file.
FAILURE: The following CDI problem marker doesn't appear on Test3.test field: "No bean is eligible for injection to the injection point [JSR-299 §5.2.1]"
ASSERT: The following CDI problem marker appears on Test3.test field: "No bean is eligible for injection to the injection point [JSR-299 §5.2.1]"