CancellableTask implements Runnable, Cancellable { @Override public void cancel() { cancel(null, null); } CancellableTask(ResultToStatus<Status, T> resultToStatus, ThrowableToStatus<Status> throwableToStatus,
                           Callable<T> callable, PrecipicePromise<Status, T> promise); @Override void run(); @Override void cancel(); void cancel(Status cancelledStatus, Exception exception);  }
@Test public void promiseTimedOutIfNotCompleted() { task = TaskFactory.createTask(TestCallable.success("Success"), promise); PrecipiceTimeoutException exception = new PrecipiceTimeoutException(); task.cancel(TimeoutableResult.TIMEOUT, exception); verify(promise).completeExceptionally(same(TimeoutableResult.TIMEOUT), same(exception)); }