AfterAllPromise extends AwexPromise<MultipleResult<Result, Progress>, Progress> { @Override public void cancelTask(boolean mayInterrupt) { try { mCancelWriteLock.lock(); super.cancelTask(mayInterrupt); for (Promise<Result, Progress> promise : mPromises) { promise.cancelTask(mayInterrupt); } } finally { mCancelWriteLock.unlock(); } } @SuppressWarnings("unchecked")  AfterAllPromise(Awex awex, Collection<Promise<Result, Progress>> promises); @Override void cancelTask(boolean mayInterrupt);  }
@Test public void shouldBeCancelledOnceAnyPromiseIsCancelled() throws Exception { setUpAwex(); setUpPromises(); mSecondPromise.cancelTask(); assertTrue(mAfterAllPromise.isCancelled()); }