/**
* Test the stateful bean callbacks.
*/
@Test
public void testStatefulBeanCallbacks() {
EasyBeansSFSBLifeCycle lifeCycle = getSFSBLifeCycle();
int internalCounter = 0;
assertEquals(internalCounter++, statefulBean.getCounter());
if (statefulBean instanceof EasyBeansSFSBLifeCycle) {
lifeCycle = (EasyBeansSFSBLifeCycle) statefulBean;
}
// postConstruct should increment the counter
lifeCycle.postConstructEasyBeansLifeCycle();
assertEquals(internalCounter++, statefulBean.getCounter());
// preDestroy should increment counter
lifeCycle.preDestroyEasyBeansLifeCycle();
assertEquals(internalCounter++, statefulBean.getCounter());
// prePassivate should increment counter
lifeCycle.prePassivateEasyBeansLifeCycle();
assertEquals(internalCounter++, statefulBean.getCounter());
// postActivate should increment counter
lifeCycle.postActivateEasyBeansLifeCycle();
assertEquals(internalCounter++, statefulBean.getCounter());
}