### Question:
TasksCleanup { @EventListener public void onShutdown(final ContextClosedEvent event) { log.info("Shutting down the scheduler due to {}", event); this.scheduler.shutdown(); } @Autowired  TasksCleanup(@Qualifier("genieTaskScheduler") @NotNull final ThreadPoolTaskScheduler scheduler); @EventListener void onShutdown(final ContextClosedEvent event);  }### Answer:
@Test void canShutdown() { final ContextClosedEvent event = Mockito.mock(ContextClosedEvent.class); final TasksCleanup cleanup = new TasksCleanup(this.scheduler); cleanup.onShutdown(event); Mockito.verify(this.scheduler, Mockito.times(1)).shutdown(); }