use of org.jboss.weld.environment.se.test.beans.CustomEvent in project core by weld.
the class StartMainObserversTest method testObservers.
@Test
public void testObservers() {
InitObserverTestBean.reset();
ObserverTestBean.reset();
WeldContainer container = startMain.go();
BeanManager manager = container.getBeanManager();
manager.fireEvent(new CustomEvent());
assertTrue(ObserverTestBean.isBuiltInObserved());
assertTrue(ObserverTestBean.isCustomObserved());
assertTrue(ObserverTestBean.isInitObserved());
assertTrue(InitObserverTestBean.isInitObserved());
}
use of org.jboss.weld.environment.se.test.beans.CustomEvent in project core by weld.
the class WeldMainTest method testObservers.
/**
* Test the firing of observers using the alternate API for booting WeldContainer from an SE app.
*/
@Test
public void testObservers() {
InitObserverTestBean.reset();
ObserverTestBean.reset();
Weld weld = new Weld();
WeldContainer container = weld.initialize();
container.event().select(CustomEvent.class).fire(new CustomEvent());
assertTrue(ObserverTestBean.isBuiltInObserved());
assertTrue(ObserverTestBean.isCustomObserved());
assertTrue(ObserverTestBean.isInitializedObserved());
assertFalse(ObserverTestBean.isDestroyedObserved());
// moved as per WELD-949
assertTrue(ObserverTestBean.isInitObserved());
assertTrue(InitObserverTestBean.isInitObserved());
weld.shutdown();
assertTrue(ObserverTestBean.isDestroyedObserved());
}
Aggregations