Task { public void toString(StringBuilder stringBuilder) { String taskName = getClass().getName(); stringBuilder.append("{ id: ") .append(mId) .append(", state: ") .append(mCurrentState) .append(", priority: ") .append(mPriority) .append(" }"); } 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 public void shouldPrintCurrentStateOfTask() { Task<Integer, Float> task = givenSomeTask(); assertEquals("{ id: 0, state: -1, priority: 3 }", task.toString()); }