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

    long duration = 5000;
    ScheduledCompletableFuture<Instant> future1 = scheduler.after(Duration.ofMillis(duration));
    Thread.sleep(500);
    ScheduledCompletableFuture<Instant> future2 = scheduler.after(Duration.ofMillis(duration));
    int compare = future1.compareTo(future2);
    assertTrue(compare < 0, "First future should be less than second");
    future1.cancel(true);
    future2.cancel(true);
}