### Question:
CdiObjectFactory extends ObjectFactory { protected InjectionTarget<?> getInjectionTarget(Class<?> clazz) { InjectionTarget<?> result; result = injectionTargetCache.get(clazz); if (result == null) { result = beanManager.createInjectionTarget(beanManager.createAnnotatedType(clazz)); injectionTargetCache.put(clazz, result); } return result; } CdiObjectFactory(); @Inject(value = "struts.objectFactory.cdi.jndiKey", required = false) void setJndiKey( String jndiKey ); @Override @SuppressWarnings({ "rawtypes", "unchecked" }) Object buildBean(String className, Map<String, Object> extraContext, boolean injectInternal); @Override boolean isNoArgConstructorRequired(); static final String CDI_JNDIKEY_BEANMANAGER_COMP; static final String CDI_JNDIKEY_BEANMANAGER_APP; static final String CDI_JNDIKEY_BEANMANAGER_COMP_ENV; }### Answer:
@Test public void testGetInjectionTarget() throws Exception { final CdiObjectFactory cdiObjectFactory = new CdiObjectFactory(); final InjectionTarget<?> injectionTarget = cdiObjectFactory.getInjectionTarget(FooConsumer.class); assertNotNull(injectionTarget); assertTrue(cdiObjectFactory.injectionTargetCache.containsKey(FooConsumer.class)); assertSame(cdiObjectFactory.getInjectionTarget(FooConsumer.class), injectionTarget); }