### Question:
CDIBeanService { public <T> T getCDIBeanByName(final String name, Class<T> clazz) { BeanManager bm = getBeanManager(); Bean<T> bean = (Bean<T>) bm.getBeans(name).iterator().next(); CreationalContext<T> ctx = bm.createCreationalContext(bean); return (T) bm.getReference(bean, clazz, ctx); } private  CDIBeanService(); static CDIBeanService getInstance(); T getCDIBean(final Class<T> clazz); T getCDIBeanByName(final String name, Class<T> clazz); void injectManual(Object obj);  }### Answer:
@Test public void getCDIBeanByName() throws Exception { final CDIBeanService cut = CDIBeanService.getInstance(); final CDITestBean cdiTestBean = cut.getCDIBeanByName("cDITestBean", CDITestBean.class); assertThat(cdiTestBean, notNullValue()); assertThat(cdiTestBean.getName(), is("I am a singleton bean")); }