@Test
  public void testFixedDelayPeriodicTaskIsRemovedByShutdownNow() throws InterruptedException {
    OutOfBandScheduledExecutor scheduler = new OutOfBandScheduledExecutor();
    ExecutorService worker = Executors.newSingleThreadExecutor();
    try {
      PartitionedScheduledExecutor executor = new PartitionedScheduledExecutor(scheduler, worker);

      ScheduledFuture<?> future =
          executor.scheduleWithFixedDelay(
              new Runnable() {

                @Override
                public void run() {
                  Assert.fail("Should not run!");
                }
              },
              2,
              1,
              MINUTES);

      assertThat(executor.shutdownNow(), hasSize(1));
      assertThat(executor.awaitTermination(30, SECONDS), is(true));
      assertThat(executor.isShutdown(), is(true));
      assertThat(executor.isTerminated(), is(true));

      assertThat(future.isDone(), is(false));
    } finally {
      worker.shutdown();
    }
  }