Scheduler extends ScheduledThreadPoolExecutor { @Override protected <V> RunnableScheduledFuture<V> decorateTask(Runnable runnable, RunnableScheduledFuture<V> future) { if (runnable instanceof RunnableContext) { ((RunnableContext) runnable).future = future; } return future; } Scheduler(int corePoolSize);  Scheduler(int corePoolSize, ThreadFactory threadFactory);  Scheduler(int corePoolSize, RejectedExecutionHandler handler);  Scheduler(int corePoolSize, ThreadFactory threadFactory, RejectedExecutionHandler handler); ScheduledFuture<?> schedule(Consumer<Context> task, long initial, long period, TimeUnit unit); ScheduledFuture<?> schedule(Consumer<Context> task, long initial, long period, TimeUnit unit, long times);  }
@Test void decorateTask_runnableContext() { var runnable = mock(RunnableContext.class); assertEquals(task, scheduler.decorateTask(runnable, task)); assertSame(task, runnable.future); }
@Test void decorateTask_runnable() { Runnable runnable = mock(Runnable.class); assertEquals(task, scheduler.decorateTask(runnable, task)); verifyNoInteractions(runnable); verifyNoInteractions(task); }