@Test
public void testRemoveHook() {

  // given
  boolean[] ran = {false};
  ShutdownHooks.Hook hook = () -> ran[0] = true;
  // when
  ShutdownHooks.addHook(hook);
  ShutdownHooks.removeHook(hook);
  ShutdownHooks.runAllHooks();
  // then
  assertFalse(ran[0], "The hook should not have run");
}