### Question:
TransactionScopedContextExtension implements Extension { public void afterBeanDiscovery(@Observes AfterBeanDiscovery event, BeanManager manager) { event.addContext(new TransactionScopedContextImpl()); event.addBean(createHelperBean(manager, TransactionScopedCDIEventHelperImpl.class)); }  void afterBeanDiscovery(@Observes AfterBeanDiscovery event, BeanManager manager);  }### Answer:
@Test @SuppressWarnings("unchecked") public void testafterBeanDiscovery() { EasyMockSupport mockSupport = new EasyMockSupport(); AfterBeanDiscovery event = mockSupport.createMock(AfterBeanDiscovery.class); BeanManager beanManager = mockSupport.createMock(BeanManager.class); AnnotatedType<TransactionScopedCDIEventHelperImpl> annotatedType = (AnnotatedType<TransactionScopedCDIEventHelperImpl>) mockSupport.createMock(AnnotatedType.class); InjectionTargetFactory injectionTargetFactory = mockSupport.createMock(InjectionTargetFactory.class); InjectionTarget injectionTarget = mockSupport.createMock(InjectionTarget.class); event.addContext(isA(TransactionScopedContextImpl.class)); expect(beanManager.createAnnotatedType(TransactionScopedCDIEventHelperImpl.class)).andReturn(annotatedType); expect(beanManager.getInjectionTargetFactory(annotatedType)).andReturn(injectionTargetFactory); expect(injectionTargetFactory.createInjectionTarget(anyObject(Bean.class))).andReturn(injectionTarget); event.addBean(anyObject(Bean.class)); mockSupport.replayAll(); TransactionScopedContextExtension transactionScopedContextExtension = new TransactionScopedContextExtension(); transactionScopedContextExtension.afterBeanDiscovery( event, beanManager ); mockSupport.verifyAll(); mockSupport.resetAll(); }