@Test public void testGet() throws Exception { FluentCaseInsensitiveStringsMap responseHeaders = new FluentCaseInsensitiveStringsMap(); responseHeaders.add("header1", "header1_value1"); responseHeaders.add("header2", "header2_value1"); List<Cookie> ningCookies = new ArrayList<>(); ningCookies.add(new Cookie( "cookie1_name", "cookie1_value", false, null, "cookie1_path", 1, true, true )); ningCookies.add(new Cookie( "cookie2_name", "cookie2_value", false, null, "cookie2_path", 2, false, false )); when(mockNingResponse.getHeaders()).thenReturn(responseHeaders); when(mockNingResponse.getContentType()).thenReturn(MediaType.APPLICATION_JSON); when(mockNingResponse.getCookies()).thenReturn(ningCookies); when(mockNingResponse.getStatusCode()).thenReturn(200); when(mockNingResponse.hasResponseHeaders()).thenReturn(true); when(mockNingFuture.get()).thenReturn(mockNingResponse); when(mockNingFuture.get(anyLong(), any(TimeUnit.class))).thenReturn(mockNingResponse); ParsecCompletableFuture<Response> future = new ParsecCompletableFuture<>(mockNingFuture); Response response = future.get(); assertEquals(response.getContentType(), MediaType.APPLICATION_JSON); assertEquals(response.getHeaders().size(), 2); response = future.get(3, TimeUnit.SECONDS); assertEquals(response.getContentType(), MediaType.APPLICATION_JSON); assertEquals(response.getHeaders().size(), 2); }
@Override public T get() throws InterruptedException, ExecutionException { return future.get(); }
ParsecCompletableFuture extends CompletableFuture<T> { @Override public T get() throws InterruptedException, ExecutionException { return future.get(); } }
ParsecCompletableFuture extends CompletableFuture<T> { @Override public T get() throws InterruptedException, ExecutionException { return future.get(); } ParsecCompletableFuture(final Future<T> future); }
ParsecCompletableFuture extends CompletableFuture<T> { @Override public T get() throws InterruptedException, ExecutionException { return future.get(); } ParsecCompletableFuture(final Future<T> future); @Override boolean cancel(boolean mayInterruptIfRunning); @Override T get(); @Override T get(long timeout, TimeUnit unit); @Override boolean isCancelled(); @Override boolean isDone(); }
ParsecCompletableFuture extends CompletableFuture<T> { @Override public T get() throws InterruptedException, ExecutionException { return future.get(); } ParsecCompletableFuture(final Future<T> future); @Override boolean cancel(boolean mayInterruptIfRunning); @Override T get(); @Override T get(long timeout, TimeUnit unit); @Override boolean isCancelled(); @Override boolean isDone();  }