SystemManager { @PreDestroy @VisibleForTesting void shutdown() throws InterruptedException { if (!statusRef.compareAndSet(RUNNING, PREPARING_TO_SHUTDOWN)) { shutdownLatch.await(); } else { doSuspendServices(); dbTermination.terminate(); } } @Inject  SystemManager(
      ServiceTerminator terminator, DBTermination dbTermination, EventService eventService); void stopServices(); void suspendServices(); SystemStatus getSystemStatus();  }
@Test public void shutdownStopsServicesIfNotStopped() throws Exception { systemManager.shutdown(); verifySuspendCompleted(); verifyDBTerminated(); }