@SpecAssertions({ @SpecAssertion(section = "11.3.3", id = "b") })
public void testGetInjectableReferenceReturnsDelegateForDelegateInjectionPoint() {
// Get hold of the correct IP by inspecting the ones the container created for LoggerConsumer
assert getBeans(LoggerConsumer.class).size() == 1;
Bean<LoggerConsumer> bean = getBeans(LoggerConsumer.class).iterator().next();
InjectionPoint loggerInjectionPoint = null;
for (InjectionPoint ip : bean.getInjectionPoints()) {
if (ip.getAnnotated().getTypeClosure().contains(Logger.class) && ip.getQualifiers().size() == 1
&& ip.getQualifiers().contains(new DefaultLiteral())) {
loggerInjectionPoint = ip;
}
}
// Now lookup an injectable reference and check that it is of type Logger
CreationalContext<Logger> creationalContext = getCurrentManager().createCreationalContext(
(Bean<Logger>) loggerInjectionPoint.getBean());
Object injectedDelegateLogger = getCurrentManager().getInjectableReference(loggerInjectionPoint, creationalContext);
assert injectedDelegateLogger instanceof Logger;
Logger logger = (Logger) injectedDelegateLogger;
// User the logger