### Question:
Scheduler implements Runnable { public void shutdown() { synchronized (lock) { if (shutdown) { log.warn("Shutdown requested a second time."); return; } workerStateChangeListener.onWorkerStateChange(WorkerStateChangeListener.WorkerState.SHUT_DOWN_STARTED); log.info("Worker shutdown requested."); shutdown = true; shutdownStartTimeMillis = System.currentTimeMillis(); leaseCoordinator.stop(); leaderElectedPeriodicShardSyncManager.stop(); workerStateChangeListener.onWorkerStateChange(WorkerStateChangeListener.WorkerState.SHUT_DOWN); } } Scheduler(@NonNull final CheckpointConfig checkpointConfig,
                     @NonNull final CoordinatorConfig coordinatorConfig,
                     @NonNull final LeaseManagementConfig leaseManagementConfig,
                     @NonNull final LifecycleConfig lifecycleConfig,
                     @NonNull final MetricsConfig metricsConfig,
                     @NonNull final ProcessorConfig processorConfig,
                     @NonNull final RetrievalConfig retrievalConfig); @VisibleForTesting protected  Scheduler(@NonNull final CheckpointConfig checkpointConfig,
                        @NonNull final CoordinatorConfig coordinatorConfig,
                        @NonNull final LeaseManagementConfig leaseManagementConfig,
                        @NonNull final LifecycleConfig lifecycleConfig,
                        @NonNull final MetricsConfig metricsConfig,
                        @NonNull final ProcessorConfig processorConfig,
                        @NonNull final RetrievalConfig retrievalConfig,
                        @NonNull final DiagnosticEventFactory diagnosticEventFactory); @Override void run(); Future<Boolean> startGracefulShutdown(); Callable<Boolean> createGracefulShutdownCallable(); boolean hasGracefulShutdownStarted(); void shutdown(); @Deprecated Future<Void> requestShutdown();  }### Answer:
@Test public final void testSchedulerShutdown() { scheduler.shutdown(); verify(workerStateChangeListener, times(1)).onWorkerStateChange(WorkerStateChangeListener.WorkerState.SHUT_DOWN_STARTED); verify(leaseCoordinator, times(1)).stop(); verify(workerStateChangeListener, times(1)).onWorkerStateChange(WorkerStateChangeListener.WorkerState.SHUT_DOWN); }