@@ -0,0 +1,1065 @@
+package org.jdeferred.impl;%0A%0Aimport org.jdeferred.DeferredFutureTask;%0Aimport org.jdeferred.DoneCallback;%0Aimport org.jdeferred.Promise;%0Aimport org.junit.Assert;%0Aimport org.junit.Test;%0A%0Aimport java.util.concurrent.Callable;%0A%0Apublic class CancelTaskTest extends AbstractDeferredTest %7B%0A%0A%09@Test%0A%09public void testCancelTask() %7B%0A%09%09DeferredFutureTask%3CString, Void%3E deferredFutureTask =%0A%09%09%09%09new DeferredFutureTask%3CString, Void%3E(new Callable%3CString%3E() %7B%0A%09%09%09%09%09@Override%0A%09%09%09%09%09public String call() throws Exception %7B%0A%09%09%09%09%09%09try %7B%0A%09%09%09%09%09%09%09Thread.sleep(1000);%0A%09%09%09%09%09%09%7D catch (InterruptedException e) %7B%0A%09%09%09%09%09%09%7D%0A%0A%09%09%09%09%09%09return %22Hello%22;%0A%09%09%09%09%09%7D%0A%09%09%09%09%7D);%0A%0A%09%09Promise%3CString, Throwable, Void%3E promise = deferredManager.when(deferredFutureTask);%0A%0A%09%09deferredFutureTask.cancel(false);%0A%0A%09%09try %7B%0A%09%09%09Thread.sleep(1000);%0A%09%09%7D catch (InterruptedException e) %7B%0A%09%09%7D%0A%0A%09%09promise.then(new DoneCallback%3CString%3E() %7B%0A%09%09%09@Override%0A%09%09%09public void onDone(String result) %7B%0A%09%09%09%09Assert.fail(%22Shouldn't be called, because task was cancelled%22);%0A%09%09%09%7D%0A%09%09%7D);%0A%0A%09%09Assert.assertTrue(deferredFutureTask.isCancelled());%0A%09%7D%0A%7D%0A

add test for cancelling a task