use of cn.taketoday.beans.testfixture.beans.LifecycleBean in project today-infrastructure by TAKETODAY.
the class XmlListableBeanFactoryTests method lifecycleMethods.
@Test
public void lifecycleMethods() {
LifecycleBean bean = (LifecycleBean) getBeanFactory().getBean("lifecycle");
bean.businessMethod();
}
use of cn.taketoday.beans.testfixture.beans.LifecycleBean in project today-framework by TAKETODAY.
the class AbstractApplicationContextTests method closeTriggersDestroy.
@Test
public void closeTriggersDestroy() {
LifecycleBean lb = (LifecycleBean) applicationContext.getBean("lifecycle");
boolean condition = !lb.isDestroyed();
assertThat(condition).as("Not destroyed").isTrue();
applicationContext.close();
if (applicationContext.getParent() != null) {
((ConfigurableApplicationContext) applicationContext.getParent()).close();
}
assertThat(lb.isDestroyed()).as("Destroyed").isTrue();
applicationContext.close();
if (applicationContext.getParent() != null) {
((ConfigurableApplicationContext) applicationContext.getParent()).close();
}
assertThat(lb.isDestroyed()).as("Destroyed").isTrue();
}
use of cn.taketoday.beans.testfixture.beans.LifecycleBean in project today-framework by TAKETODAY.
the class XmlListableBeanFactoryTests method lifecycleMethods.
@Test
public void lifecycleMethods() {
LifecycleBean bean = (LifecycleBean) getBeanFactory().getBean("lifecycle");
bean.businessMethod();
}
use of cn.taketoday.beans.testfixture.beans.LifecycleBean in project today-infrastructure by TAKETODAY.
the class AbstractApplicationContextTests method closeTriggersDestroy.
@Test
public void closeTriggersDestroy() {
LifecycleBean lb = (LifecycleBean) applicationContext.getBean("lifecycle");
boolean condition = !lb.isDestroyed();
assertThat(condition).as("Not destroyed").isTrue();
applicationContext.close();
if (applicationContext.getParent() != null) {
((ConfigurableApplicationContext) applicationContext.getParent()).close();
}
assertThat(lb.isDestroyed()).as("Destroyed").isTrue();
applicationContext.close();
if (applicationContext.getParent() != null) {
((ConfigurableApplicationContext) applicationContext.getParent()).close();
}
assertThat(lb.isDestroyed()).as("Destroyed").isTrue();
}
Aggregations