@Override
  public Future<?> schedule(Executor executor, Runnable command, long delay, TimeUnit unit) {
    requireNonNull(executor);
    requireNonNull(command);
    requireNonNull(unit);

    if (scheduledExecutorService.isShutdown()) {
      return DisabledFuture.INSTANCE;
    }
    return scheduledExecutorService.schedule(() -> {
      try {
        executor.execute(command);
      } catch (Throwable t) {
        logger.log(Level.WARNING, "Exception thrown when submitting scheduled task", t);
        throw t;
      }
    }, delay, unit);
  }
@Test
  public void scheduledExecutorService_schedule() {
    ScheduledExecutorService scheduledExecutor = Mockito.mock();
    var task = ArgumentCaptor.forClass(Runnable.class);
    Executor executor = Mockito.mock();
    Runnable command = () -> {};

    var scheduler = Scheduler.forScheduledExecutorService(scheduledExecutor);
    var future = scheduler.schedule(executor, command, 1L, TimeUnit.MINUTES);
    assertThat(future).isNotSameInstanceAs(DisabledFuture.INSTANCE);

    verify(scheduledExecutor).isShutdown();
    verify(scheduledExecutor).schedule(task.capture(), eq(1L), eq(TimeUnit.MINUTES));
    verifyNoMoreInteractions(scheduledExecutor);

    task.getValue().run();
    verify(executor).execute(command);
    verifyNoMoreInteractions(executor);
  }