CompletableToListenableFutureAdapter implements ListenableFuture<T> { @Override public void addCallback(final ListenableFutureCallback<? super T> callback) { callbacks.addCallback(callback); } CompletableToListenableFutureAdapter(final CompletableFuture<T> future); @Override void addCallback(final ListenableFutureCallback<? super T> callback); @Override void addCallback(final SuccessCallback<? super T> successCallback, final FailureCallback failureCallback);  }
@Test void shouldCallSuccessCallback() { future.complete("test"); unit.addCallback(success, failure); verify(success).onSuccess("test"); }
@Test void shouldCallFailureCallback() { final AssertionError error = new AssertionError(); future.completeExceptionally(error); unit.addCallback(success, failure); verify(failure).onFailure(error); }
@Test void shouldCallCombinedSuccessCallback() { future.complete("test"); unit.addCallback(callback); verify(callback).onSuccess("test"); }
@Test void shouldCallCombinedFailureCallback() { final AssertionError error = new AssertionError(); future.completeExceptionally(error); unit.addCallback(callback); verify(callback).onFailure(error); }