org.jboss.weld.test.core.TestCore is used by the org.jboss.weld.test.junit.CDIRunner to
inject the dependencies of the test case. However, it only supports injection of qualified
fields. As a side effect, dependencies declared as concrete classes can not be injected,
since qualifiers only make sense to interface/abstract dependency declarations:
package org.jboss.weld.test.core;
...
public class TestCore {
...
private void injectField(Field field, Object target) throws Exception
{
if (!hasBindTypeAnnotation(field.getAnnotations()))
{
return;
}
if (!field.isAccessible())
{
field.setAccessible(true);
}
Object injectable = getInstanceByType(field.getType(), field
.getAnnotations());
if (injectable != null)
{
field.set(target, injectable);
}
}
Just wondering the value of this restriction?
/Johan