use of cn.taketoday.framework.context.event.ApplicationFailedEvent in project today-infrastructure by TAKETODAY.
the class ApplicationTests method deregistersShutdownHookForFailedApplicationContext.
@Test
void deregistersShutdownHookForFailedApplicationContext() {
Application application = new Application(BrokenPostConstructConfig.class);
List<ApplicationEvent> events = new ArrayList<>();
application.addListeners(events::add);
application.setApplicationType(ApplicationType.NONE_WEB);
assertThatExceptionOfType(BeanCreationException.class).isThrownBy(application::run);
assertThat(events).hasAtLeastOneElementOfType(ApplicationFailedEvent.class);
ApplicationFailedEvent failure = events.stream().filter((event) -> event instanceof ApplicationFailedEvent).map(ApplicationFailedEvent.class::cast).findFirst().get();
assertThat(ApplicationShutdownHookInstance.get()).didNotRegisterApplicationContext(failure.getApplicationContext());
}
use of cn.taketoday.framework.context.event.ApplicationFailedEvent in project today-framework by TAKETODAY.
the class ApplicationTests method deregistersShutdownHookForFailedApplicationContext.
@Test
void deregistersShutdownHookForFailedApplicationContext() {
Application application = new Application(BrokenPostConstructConfig.class);
List<ApplicationEvent> events = new ArrayList<>();
application.addListeners(events::add);
application.setApplicationType(ApplicationType.NONE_WEB);
assertThatExceptionOfType(BeanCreationException.class).isThrownBy(application::run);
assertThat(events).hasAtLeastOneElementOfType(ApplicationFailedEvent.class);
ApplicationFailedEvent failure = events.stream().filter((event) -> event instanceof ApplicationFailedEvent).map(ApplicationFailedEvent.class::cast).findFirst().get();
assertThat(ApplicationShutdownHookInstance.get()).didNotRegisterApplicationContext(failure.getApplicationContext());
}
Aggregations