Code example for ListenableFuture

Methods: addListener

0
 
  public MockFutureListener(ListenableFuture<?> future) {
    this.countDownLatch = new CountDownLatch(1);
    this.future = future;
 
    future.addListener(this, MoreExecutors.sameThreadExecutor());
  } 
 
  @Override 
  public void run() { 
    countDownLatch.countDown();
  } 
 
  /** 
   * Verify that the listener completes in a reasonable amount of time, and 
   * Asserts that the future returns the expected data. 
   * @throws Throwable if the listener isn't called or if it resulted in a 
   *     throwable or if the result doesn't match the expected value. 
   */ 
  public void assertSuccess(Object expectedData) throws Throwable {
Connect your IDE to all the code out there  Get Codota for Java