@Test public void factoryMethodForErrorShouldReturnDoneFuture() throws Exception { Exception exception = new Exception(); CompletableFuture<HttpResponse<String>> future = ResponseFuture.error(exception); assertTrue(future.isDone()); assertFalse(future.isCancelled()); try { future.get(1, TimeUnit.MILLISECONDS); fail("should have thrown exception"); } catch (ExecutionException ee) { assertSame(exception, ee.getCause()); } }
public static <T> CompletableFuture<HttpResponse<T>> error(Throwable error) { ResponseFuture<T> future = new ResponseFuture<>(new NoopRequestEventBus(), null, null); future.completeExceptionally(error); return future; }
ResponseFuture extends CompletableFuture<HttpResponse<T>> { public static <T> CompletableFuture<HttpResponse<T>> error(Throwable error) { ResponseFuture<T> future = new ResponseFuture<>(new NoopRequestEventBus(), null, null); future.completeExceptionally(error); return future; } }
ResponseFuture extends CompletableFuture<HttpResponse<T>> { public static <T> CompletableFuture<HttpResponse<T>> error(Throwable error) { ResponseFuture<T> future = new ResponseFuture<>(new NoopRequestEventBus(), null, null); future.completeExceptionally(error); return future; } ResponseFuture(RequestEventBus requestEventBus, HttpRequestContext requestContext, Executor callbackExecutor); }
ResponseFuture extends CompletableFuture<HttpResponse<T>> { public static <T> CompletableFuture<HttpResponse<T>> error(Throwable error) { ResponseFuture<T> future = new ResponseFuture<>(new NoopRequestEventBus(), null, null); future.completeExceptionally(error); return future; } ResponseFuture(RequestEventBus requestEventBus, HttpRequestContext requestContext, Executor callbackExecutor); @Override boolean cancel(boolean mayInterruptIfRunning); static CompletableFuture<HttpResponse<T>> error(Throwable error); }
ResponseFuture extends CompletableFuture<HttpResponse<T>> { public static <T> CompletableFuture<HttpResponse<T>> error(Throwable error) { ResponseFuture<T> future = new ResponseFuture<>(new NoopRequestEventBus(), null, null); future.completeExceptionally(error); return future; } ResponseFuture(RequestEventBus requestEventBus, HttpRequestContext requestContext, Executor callbackExecutor); @Override boolean cancel(boolean mayInterruptIfRunning); static CompletableFuture<HttpResponse<T>> error(Throwable error);  }