### Question:
Hook { public void shutdown() { keepRunning = false; thread.interrupt(); try { thread.join(); } catch (InterruptedException e) { logger.error("Error shutting down thread with hook", e); } } Hook(Thread thread); boolean keepRunning(); void shutdown();  }### Answer:
@Test public void testShutdown() throws InterruptedException { assertTrue(instance.keepRunning()); instance.shutdown(); assertFalse(instance.keepRunning()); }