### Question:
Scheduler implements Runnable { public void shutdown() { long startedAt = systemClock.currentTimeMillis(); synchronized (executor) { logger.fine("Stopping scheduler"); executor.shutdown(); try { executor.awaitTermination(10, TimeUnit.SECONDS); } catch (InterruptedException e) { logger.fine("Stop interrupted"); } if (dynamicConfig != null) { codeBasePublisherState.scheduleNow(); publishCodeBaseIfNeeded(); invocationDataPublisherState.scheduleNow(); publishInvocationDataIfNeeded(); } } logger.info( String.format( "Codekvast scheduler stopped in %d ms", systemClock.currentTimeMillis() - startedAt)); } Scheduler(
      AgentConfig config,
      ConfigPoller configPoller,
      CodeBasePublisherFactory codeBasePublisherFactory,
      InvocationDataPublisherFactory invocationDataPublisherFactory,
      SystemClock systemClock); Scheduler start(); void shutdown(); @Override void run();  }### Answer:
@Test public void should_handle_shutdown_before_first_poll() { scheduler.shutdown(); verifyNoMoreInteractions(configPollerMock); output.expect(containsString("Codekvast scheduler stopped in 0 ms")); assertThat(codeBasePublisher.getSequenceNumber(), is(0)); assertThat(invocationDataPublisher.getSequenceNumber(), is(0)); }