DefaultShutdownManager implements ShutdownManager { protected Map<?, ? extends Throwable> shutdownAll() { Map<Object, Throwable> errors = new HashMap<>(); shutdownHooks.keySet().forEach(c -> shutdownOne(c).ifPresent(e -> errors.put(c, e))); return errors; } DefaultShutdownManager(Duration timeout); @Override void addShutdownHook(AutoCloseable shutdownHook); @Override Map<?, ? extends Throwable> shutdown();  }
@Test public void testShutdownAll_Empty() throws Exception { shutdownManager.shutdownAll(); }
@Test public void testShutdownAll() throws Exception { shutdownManager.addShutdownHook(mockCloseable1); shutdownManager.addShutdownHook(mockCloseable2); shutdownManager.shutdownAll(); verify(mockCloseable1).close(); verify(mockCloseable2).close(); }