Code example for ListenableFuture

Methods: get

0
    Throwable expected = new GraphExecutionException(null, currentCallInfo, NO_CALLS);
 
    ListenableFuture<String> future = fallback.create(expected);
 
    try { 
      future.get();
      fail("expected an exception"); 
    } catch (ExecutionException e) {
      assertThat(e.getCause(), equalTo(expected));
    } 
  } 
 
  @Test
  public void shouldWrapGeneralException() throws Exception {
    Throwable expected = new RuntimeException("expected");
 
    ListenableFuture<String> future = fallback.create(expected);
 
    try { 
      future.get();