withHookWhenHookThrowsAbandonedRunExceptionAbandonsRun() — spring-boot Function Reference
Architecture documentation for the withHookWhenHookThrowsAbandonedRunExceptionAbandonsRun() function in SpringApplicationTests.java from the spring-boot codebase.
Entity Profile
Dependency Diagram
graph TD f2cb6f7a_667c_db66_9290_d949463566fc["withHookWhenHookThrowsAbandonedRunExceptionAbandonsRun()"] ff7e5b91_a4f4_e0a5_d92b_ae7a506efd07["getApplicationContext()"] f2cb6f7a_667c_db66_9290_d949463566fc -->|calls| ff7e5b91_a4f4_e0a5_d92b_ae7a506efd07 3613e214_49bf_015b_c43f_7f8a1274fb0b["run()"] f2cb6f7a_667c_db66_9290_d949463566fc -->|calls| 3613e214_49bf_015b_c43f_7f8a1274fb0b 38fc4cf6_e1f4_234f_e57e_0772756d13fc["onApplicationEvent()"] f2cb6f7a_667c_db66_9290_d949463566fc -->|calls| 38fc4cf6_e1f4_234f_e57e_0772756d13fc style f2cb6f7a_667c_db66_9290_d949463566fc fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
core/spring-boot/src/test/java/org/springframework/boot/SpringApplicationTests.java lines 1359–1391
@Test
@SuppressWarnings({ "rawtypes", "unchecked" })
void withHookWhenHookThrowsAbandonedRunExceptionAbandonsRun() {
SpringApplication application = new SpringApplication(ExampleConfig.class);
ApplicationListener listener = mock(ApplicationListener.class);
application.addListeners(listener);
application.setWebApplicationType(WebApplicationType.NONE);
SpringApplicationRunListener runListener = spy(new SpringApplicationRunListener() {
@Override
public void contextLoaded(ConfigurableApplicationContext context) {
throw new SpringApplication.AbandonedRunException(context);
}
});
SpringApplicationHook hook = (springApplication) -> runListener;
assertThatExceptionOfType(SpringApplication.AbandonedRunException.class)
.isThrownBy(() -> SpringApplication.withHook(hook, () -> application.run()))
.satisfies((ex) -> {
ConfigurableApplicationContext context = ex.getApplicationContext();
assertThat(context).isNotNull();
assertThat(context.isRunning()).isFalse();
});
then(runListener).should().starting(any());
then(runListener).should().contextPrepared(any());
then(runListener).should(never()).ready(any(), any());
then(runListener).should(never()).failed(any(), any());
then(listener).should().onApplicationEvent(any(ApplicationStartingEvent.class));
then(listener).should().onApplicationEvent(any(ApplicationEnvironmentPreparedEvent.class));
then(listener).should().onApplicationEvent(any(ApplicationPreparedEvent.class));
then(listener).should(never()).onApplicationEvent(any(ApplicationReadyEvent.class));
then(listener).should(never()).onApplicationEvent(any(ApplicationFailedEvent.class));
}
Domain
Subdomains
Source
Frequently Asked Questions
What does withHookWhenHookThrowsAbandonedRunExceptionAbandonsRun() do?
withHookWhenHookThrowsAbandonedRunExceptionAbandonsRun() is a function in the spring-boot codebase.
What does withHookWhenHookThrowsAbandonedRunExceptionAbandonsRun() call?
withHookWhenHookThrowsAbandonedRunExceptionAbandonsRun() calls 3 function(s): getApplicationContext, onApplicationEvent, run.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free