Task { public void reset() { try { lock.lock(); if (mCurrentState != STATE_FINISHED) { throw new IllegalStateException("Trying to reuse an already submitted task"); } mCurrentState = STATE_NOT_INITIALIZED; onReset(); } finally { lock.unlock(); } } Task();  Task(int priority);  Task(int priority, int queueTimeout, int executionTimeout); long getId(); int getPriority(); int getState(); boolean isCancelled(); void reset(); Promise<Result, Progress> getPromise(); void toString(StringBuilder stringBuilder); @Override String toString(); static final int STATE_NOT_INITIALIZED; static final int STATE_NOT_QUEUE; static final int STATE_QUEUE; static final int STATE_RUNNING; static final int STATE_FINISHED; static final int STATE_CANCELLING; static final int STATE_CANCELLED; static final int PRIORITY_LOWEST; static final int PRIORITY_LOW; static final int PRIORITY_NORMAL; static final int PRIORITY_HIGH; static final int PRIORITY_REAL_TIME; }
@Test(expected = IllegalStateException.class) public void shouldFailToResetNotSubmittedTask() { Task<Integer, Float> task = givenSomeTask(); task.reset(); }