### Question:
C5Futures { public static <V> void addCallback(@NotNull ListenableFuture<V> future, @NotNull Consumer<? super V> success, @NotNull Consumer<Throwable> failure, @NotNull Fiber fiber) { Runnable callbackListener = () -> { final V value; try { value = getUninterruptibly(future); } catch (ExecutionException | RuntimeException | Error e) { failure.accept(e); return; } success.accept(value); }; future.addListener(callbackListener, fiber); }  static void addCallback(@NotNull ListenableFuture<V> future,
                                     @NotNull Consumer<? super V> success,
                                     @NotNull Consumer<Throwable> failure,
                                     @NotNull Fiber fiber); static V getUninterruptibly(@NotNull Future<V> future);  }### Answer:
@Test public void testC5FutureCallback_Success() throws Exception { Integer futureValue = 12; context.checking(new Expectations() {{ oneOf(mockFuture).get(); will(returnValue(futureValue)); oneOf(success).accept(futureValue); }}); C5Futures.addCallback(mockFuture, success, failure, mockFiber); }
@Test public void testC5FutureCallback_Failure() throws Exception { Exception error = new ExecutionException(new Exception()); context.checking(new Expectations() {{ oneOf(mockFuture).get(); will(throwException(error)); oneOf(failure).accept(error); }}); C5Futures.addCallback(mockFuture, success, failure, mockFiber); }