use of org.springframework.boot.DefaultBootstrapContext in project spring-boot by spring-projects.
the class RestartApplicationListenerTests method testInitialize.
private void testInitialize(boolean failed) {
Restarter.clearInstance();
RestartApplicationListener listener = new RestartApplicationListener();
DefaultBootstrapContext bootstrapContext = new DefaultBootstrapContext();
SpringApplication application = new SpringApplication();
ConfigurableApplicationContext context = mock(ConfigurableApplicationContext.class);
listener.onApplicationEvent(new ApplicationStartingEvent(bootstrapContext, application, ARGS));
assertThat(Restarter.getInstance()).isNotEqualTo(nullValue());
assertThat(Restarter.getInstance().isFinished()).isFalse();
listener.onApplicationEvent(new ApplicationPreparedEvent(application, ARGS, context));
if (failed) {
listener.onApplicationEvent(new ApplicationFailedEvent(application, ARGS, context, new RuntimeException()));
} else {
listener.onApplicationEvent(new ApplicationReadyEvent(application, ARGS, context, null));
}
}
use of org.springframework.boot.DefaultBootstrapContext in project spring-boot by spring-projects.
the class DelegatingApplicationListenerTests method emptyInitializers.
@Test
void emptyInitializers() {
TestPropertySourceUtils.addInlinedPropertiesToEnvironment(this.context, "context.listener.classes:");
this.listener.onApplicationEvent(new ApplicationEnvironmentPreparedEvent(new DefaultBootstrapContext(), new SpringApplication(), new String[0], this.context.getEnvironment()));
}
Aggregations