BeanInstantiater { public <T> T instantiate(final Bean<T> bean) { return beanManager.getContext(bean.getScope()) .get(bean, beanManager.createCreationalContext(bean)); }  T instantiate(final Bean<T> bean);  }
@Test @SuppressWarnings("unchecked") public void shouldInstantiateABean() throws Exception { final Bean<Object> bean = mock(Bean.class); final Context context = mock(Context.class); final CreationalContext<Object> creationalContext = mock(CreationalContext.class); final Object instance = mock(Object.class); when(beanManager.getContext(bean.getScope())).thenReturn(context); when(beanManager.createCreationalContext(bean)).thenReturn(creationalContext); when(context.get(bean, creationalContext)).thenReturn(instance); final Object result = beanInstantiater.instantiate(bean); assertThat(result, is(instance)); }