@Test public void testWhenCancelled() { final Stage<From> stage = mock(Stage.class); final Runnable runnable = mock(Runnable.class); final ArgumentCaptor<Runnable> captor = ArgumentCaptor.forClass(Runnable.class); doReturn(stage).when(c.completable).whenDone(captor.capture()); assertEquals(stage, c.completable.whenCancelled(runnable)); verify(c.completable).whenDone(captor.getValue()); }
@Override public Stage<T> whenCancelled(final Runnable cancelled) { return whenDone(new CancelledRunnable(cancelled)); }
ConcurrentCompletable extends AbstractImmediate<T> implements Handle<T>, Completable<T> { @Override public Stage<T> whenCancelled(final Runnable cancelled) { return whenDone(new CancelledRunnable(cancelled)); } }
ConcurrentCompletable extends AbstractImmediate<T> implements Handle<T>, Completable<T> { @Override public Stage<T> whenCancelled(final Runnable cancelled) { return whenDone(new CancelledRunnable(cancelled)); } ConcurrentCompletable(final Caller caller);   ConcurrentCompletable(final Caller caller, final Runnable runnable); }
ConcurrentCompletable extends AbstractImmediate<T> implements Handle<T>, Completable<T> { @Override public Stage<T> whenCancelled(final Runnable cancelled) { return whenDone(new CancelledRunnable(cancelled)); } ConcurrentCompletable(final Caller caller);   ConcurrentCompletable(final Caller caller, final Runnable runnable); @Override void completed(final T result); @Override void failed(final Throwable cause); @Override void cancelled(); @Override boolean complete(final T result); @Override boolean fail(final Throwable cause); @Override boolean cancel(); @Override Stage<T> handle(final Handle<? super T> handle); @Override Stage<T> whenDone(final Runnable finishable); @Override Stage<T> whenComplete(final Consumer<? super T> consumer); @Override Stage<T> whenFailed(final Consumer<? super Throwable> consumer); @Override Stage<T> whenCancelled(final Runnable cancelled); @Override boolean isDone(); @Override boolean isCompleted(); @Override boolean isFailed(); @Override boolean isCancelled(); @Override Throwable cause(); @SuppressWarnings("unchecked") @Override T join(); @Override T joinNow(); @Override T join(long timeout, TimeUnit unit); @Override Stage<U> thenApply(Function<? super T, ? extends U> fn); @Override Stage<U> thenCompose(final Function<? super T, ? extends Stage<U>> fn); @Override Stage<T> thenApplyFailed(final Function<? super Throwable, ? extends T> fn); @Override Stage<T> thenComposeCaught(final Function<? super Throwable, ? extends Stage<T>> fn); @Override Stage<T> withCloser(
    final Supplier<? extends Stage<Void>> complete, final Supplier<? extends Stage<Void>> notComplete
  ); @Override Stage<T> withComplete(final Supplier<? extends Stage<Void>> supplier); @Override Stage<T> withNotComplete(
    final Supplier<? extends Stage<Void>> supplier
  ); @Override Stage<U> thenFail(final Throwable cause); @Override Stage<U> thenComplete(final U result); @Override Stage<U> thenCancel(); @Override String toString(); }
ConcurrentCompletable extends AbstractImmediate<T> implements Handle<T>, Completable<T> { @Override public Stage<T> whenCancelled(final Runnable cancelled) { return whenDone(new CancelledRunnable(cancelled)); } ConcurrentCompletable(final Caller caller);   ConcurrentCompletable(final Caller caller, final Runnable runnable); @Override void completed(final T result); @Override void failed(final Throwable cause); @Override void cancelled(); @Override boolean complete(final T result); @Override boolean fail(final Throwable cause); @Override boolean cancel(); @Override Stage<T> handle(final Handle<? super T> handle); @Override Stage<T> whenDone(final Runnable finishable); @Override Stage<T> whenComplete(final Consumer<? super T> consumer); @Override Stage<T> whenFailed(final Consumer<? super Throwable> consumer); @Override Stage<T> whenCancelled(final Runnable cancelled); @Override boolean isDone(); @Override boolean isCompleted(); @Override boolean isFailed(); @Override boolean isCancelled(); @Override Throwable cause(); @SuppressWarnings("unchecked") @Override T join(); @Override T joinNow(); @Override T join(long timeout, TimeUnit unit); @Override Stage<U> thenApply(Function<? super T, ? extends U> fn); @Override Stage<U> thenCompose(final Function<? super T, ? extends Stage<U>> fn); @Override Stage<T> thenApplyFailed(final Function<? super Throwable, ? extends T> fn); @Override Stage<T> thenComposeCaught(final Function<? super Throwable, ? extends Stage<T>> fn); @Override Stage<T> withCloser(
    final Supplier<? extends Stage<Void>> complete, final Supplier<? extends Stage<Void>> notComplete
  ); @Override Stage<T> withComplete(final Supplier<? extends Stage<Void>> supplier); @Override Stage<T> withNotComplete(
    final Supplier<? extends Stage<Void>> supplier
  ); @Override Stage<U> thenFail(final Throwable cause); @Override Stage<U> thenComplete(final U result); @Override Stage<U> thenCancel(); @Override String toString();  }