@Test public void testWrappedPromiseIsCompletedOnError() throws Exception { Eventual<TestResult, String> eventual = new Eventual<>(wrappedPromise); RuntimeException ex = new RuntimeException(); eventual.completeExceptionally(TestResult.ERROR, ex); verify(wrappedPromise).completeExceptionally(TestResult.ERROR, ex); }
@Override public boolean completeExceptionally(Result result, Throwable exception) { if (this.result.get() == null) { if (this.result.compareAndSet(null, result)) { throwable = exception; executeInternalCallback(result); latch.countDown(); PrecipiceFunction<Result, Throwable> cb = errorCallback.get(); if (cb != null && errorCallback.compareAndSet(cb, null)) { cb.apply(result, exception); } if (wrappedPromise != null) { wrappedPromise.completeExceptionally(result, exception); } return true; } } return false; }
Eventual implements PrecipiceFuture<Result, V>, PrecipicePromise<Result, V>,
        ExecutionContext { @Override public boolean completeExceptionally(Result result, Throwable exception) { if (this.result.get() == null) { if (this.result.compareAndSet(null, result)) { throwable = exception; executeInternalCallback(result); latch.countDown(); PrecipiceFunction<Result, Throwable> cb = errorCallback.get(); if (cb != null && errorCallback.compareAndSet(cb, null)) { cb.apply(result, exception); } if (wrappedPromise != null) { wrappedPromise.completeExceptionally(result, exception); } return true; } } return false; } }
Eventual implements PrecipiceFuture<Result, V>, PrecipicePromise<Result, V>,
        ExecutionContext { @Override public boolean completeExceptionally(Result result, Throwable exception) { if (this.result.get() == null) { if (this.result.compareAndSet(null, result)) { throwable = exception; executeInternalCallback(result); latch.countDown(); PrecipiceFunction<Result, Throwable> cb = errorCallback.get(); if (cb != null && errorCallback.compareAndSet(cb, null)) { cb.apply(result, exception); } if (wrappedPromise != null) { wrappedPromise.completeExceptionally(result, exception); } return true; } } return false; } Eventual();  Eventual(long permitCount);  Eventual(long permitCount, long startNanos);  Eventual(Completable<Result, V> completable);  Eventual(long permitCount, long startNanos, Completable<Result, V> completable); }
Eventual implements PrecipiceFuture<Result, V>, PrecipicePromise<Result, V>,
        ExecutionContext { @Override public boolean completeExceptionally(Result result, Throwable exception) { if (this.result.get() == null) { if (this.result.compareAndSet(null, result)) { throwable = exception; executeInternalCallback(result); latch.countDown(); PrecipiceFunction<Result, Throwable> cb = errorCallback.get(); if (cb != null && errorCallback.compareAndSet(cb, null)) { cb.apply(result, exception); } if (wrappedPromise != null) { wrappedPromise.completeExceptionally(result, exception); } return true; } } return false; } Eventual();  Eventual(long permitCount);  Eventual(long permitCount, long startNanos);  Eventual(Completable<Result, V> completable);  Eventual(long permitCount, long startNanos, Completable<Result, V> completable); @Override boolean complete(Result result, V value); @Override boolean completeExceptionally(Result result, Throwable exception); @Override ResultView<Result, V> resultView(); @Override PrecipiceFuture<Result, V> future(); @Override V get(); @Override V get(long timeout, TimeUnit unit); @Override boolean isDone(); @Override boolean isCancelled(); @Override boolean cancel(boolean mayInterruptIfRunning); @Override void await(); @Override void await(long duration, TimeUnit unit); @Override V getValue(); @Override Throwable getError(); @Override void onSuccess(PrecipiceFunction<Result, V> fn); @Override void onError(PrecipiceFunction<Result, Throwable> fn); @Override Result getResult(); @Override long startNanos(); @Override long permitCount(); void setCancellable(Cancellable cancellable); void internalOnComplete(PrecipiceFunction<Result, ExecutionContext> fn); }
Eventual implements PrecipiceFuture<Result, V>, PrecipicePromise<Result, V>,
        ExecutionContext { @Override public boolean completeExceptionally(Result result, Throwable exception) { if (this.result.get() == null) { if (this.result.compareAndSet(null, result)) { throwable = exception; executeInternalCallback(result); latch.countDown(); PrecipiceFunction<Result, Throwable> cb = errorCallback.get(); if (cb != null && errorCallback.compareAndSet(cb, null)) { cb.apply(result, exception); } if (wrappedPromise != null) { wrappedPromise.completeExceptionally(result, exception); } return true; } } return false; } Eventual();  Eventual(long permitCount);  Eventual(long permitCount, long startNanos);  Eventual(Completable<Result, V> completable);  Eventual(long permitCount, long startNanos, Completable<Result, V> completable); @Override boolean complete(Result result, V value); @Override boolean completeExceptionally(Result result, Throwable exception); @Override ResultView<Result, V> resultView(); @Override PrecipiceFuture<Result, V> future(); @Override V get(); @Override V get(long timeout, TimeUnit unit); @Override boolean isDone(); @Override boolean isCancelled(); @Override boolean cancel(boolean mayInterruptIfRunning); @Override void await(); @Override void await(long duration, TimeUnit unit); @Override V getValue(); @Override Throwable getError(); @Override void onSuccess(PrecipiceFunction<Result, V> fn); @Override void onError(PrecipiceFunction<Result, Throwable> fn); @Override Result getResult(); @Override long startNanos(); @Override long permitCount(); void setCancellable(Cancellable cancellable); void internalOnComplete(PrecipiceFunction<Result, ExecutionContext> fn);  }