@Test
@Timeout(value = 1, unit = TimeUnit.SECONDS)
public void testScheduleCancel() throws InterruptedException {

    Semaphore s = new Semaphore(0);
    TestSchedulerTemporalAdjuster temporalAdjuster = new TestSchedulerTemporalAdjuster();
    ScheduledCompletableFuture<Void> schedule = scheduler.schedule(s::release, temporalAdjuster);
    s.acquire(1);
    Thread.sleep(50);
    schedule.cancel(true);
    Thread.sleep(300); // wait a little longer to see if not more are scheduled.
    assertEquals(0, s.availablePermits(), "Scheduler should not have released more after cancel");
    assertEquals(1, temporalAdjuster.getCount(), "Scheduler should have run 1 time");
}