Code example for ListenableFuture

Methods: get

0
  public void assertSuccess(Object expectedData) throws Throwable {
    // Verify that the listener executed in a reasonable amount of time. 
    Assert.assertTrue(countDownLatch.await(1L, TimeUnit.SECONDS));
 
    try { 
      Assert.assertEquals(expectedData, future.get());
    } catch (ExecutionException e) {
      throw e.getCause();
    } 
  } 
 
  /** 
   * Verify that the listener completes in a reasonable amount of time, and 
   * Asserts that the future throws an {@code ExecutableException} and that the 
   * cause of the {@code ExecutableException} is {@code expectedCause}. 
   */ 
  public void assertException(Throwable expectedCause) throws Exception {
    // Verify that the listener executed in a reasonable amount of time. 
    Assert.assertTrue(countDownLatch.await(1L, TimeUnit.SECONDS));
 
Connect your IDE to all the code out there  Get Codota for Java