@Test public void testMarkAsScheduled() { Task task = new SimpleTask("Test Task", c -> {}); task.markAsScheduled(); assertThat(task.getState(), is(TaskState.SCHEDULED)); }
public void markAsScheduled() { if (state != TaskState.INITIALIZING && state != TaskState.SCHEDULED) { throw new IllegalStateException("Only valid if in INITIALIZING state, but is " + state); } state = TaskState.SCHEDULED; }
Task implements Runnable { public void markAsScheduled() { if (state != TaskState.INITIALIZING && state != TaskState.SCHEDULED) { throw new IllegalStateException("Only valid if in INITIALIZING state, but is " + state); } state = TaskState.SCHEDULED; } }
Task implements Runnable { public void markAsScheduled() { if (state != TaskState.INITIALIZING && state != TaskState.SCHEDULED) { throw new IllegalStateException("Only valid if in INITIALIZING state, but is " + state); } state = TaskState.SCHEDULED; } Task(String title); }
Task implements Runnable { public void markAsScheduled() { if (state != TaskState.INITIALIZING && state != TaskState.SCHEDULED) { throw new IllegalStateException("Only valid if in INITIALIZING state, but is " + state); } state = TaskState.SCHEDULED; } Task(String title); void markAsScheduled(); @Override void run(); String getTitle(); double getProgress(); String getCurrentStatus(); TaskState getState(); Throwable getException(); @Override String toString(); }
Task implements Runnable { public void markAsScheduled() { if (state != TaskState.INITIALIZING && state != TaskState.SCHEDULED) { throw new IllegalStateException("Only valid if in INITIALIZING state, but is " + state); } state = TaskState.SCHEDULED; } Task(String title); void markAsScheduled(); @Override void run(); String getTitle(); double getProgress(); String getCurrentStatus(); TaskState getState(); Throwable getException(); @Override String toString();  }