ScheduledTaskImpl implements ScheduledTask { synchronized void setDone(Throwable result) { if ((state != State.RUNNING) && (state != State.INTERRUPTED)) { return; } state = State.COMPLETED; this.result = result; notifyAll(); } private  ScheduledTaskImpl(Builder builder); KernelRunnable getTask(); Identity getOwner(); Priority getPriority(); long getStartTime(); long getPeriod(); int getTryCount(); long getTimeout(); Throwable getLastFailure(); void setPriority(Priority priority); boolean isRecurring(); RecurringTaskHandle getRecurringTaskHandle(); synchronized boolean isCancelled(); synchronized boolean cancel(boolean block); void setTimeout(long timeout); String toString();  }
@Test public void setDoneWhenRunnable() throws Exception { setTaskState("RUNNABLE"); task.setDone(null); Assert.assertEquals("RUNNABLE", getTaskState()); }
@Test public void setDoneWhenRunning() throws Exception { setTaskState("RUNNING"); task.setDone(null); Assert.assertEquals("COMPLETED", getTaskState()); }
@Test public void setDoneWhenInterrupted() throws Exception { setTaskState("INTERRUPTED"); task.setDone(null); Assert.assertEquals("COMPLETED", getTaskState()); }
@Test public void setDoneWhenCompleted() throws Exception { setTaskState("COMPLETED"); task.setDone(null); Assert.assertEquals("COMPLETED", getTaskState()); }
@Test public void setDoneWhenCancelled() throws Exception { setTaskState("CANCELLED"); task.setDone(null); Assert.assertEquals("CANCELLED", getTaskState()); }