Examples of wasCalled()


Examples of com.google.common.util.concurrent.FuturesTest.SingleCallListener.wasCalled()

    SingleCallListener singleCallListener = new SingleCallListener();
    singleCallListener.expectCall();

    assertFalse(spy.wasExecuted);
    assertFalse(singleCallListener.wasCalled());
    assertTrue(listenableFuture.isDone()); // We call AbstractFuture#set above.

    // #addListener() will run the listener immediately because the Future is
    // already finished (we explicitly set the result of it above).
    listenableFuture.addListener(singleCallListener, directExecutor());
View Full Code Here

Examples of com.google.common.util.concurrent.FuturesTest.SingleCallListener.wasCalled()

    assertEquals(DATA1, listenableFuture.get());

    // 'spy' should have been ignored since 'abstractFuture' was done before
    // a listener was added.
    assertFalse(spy.wasExecuted);
    assertTrue(singleCallListener.wasCalled());
    assertTrue(listenableFuture.isDone());
  }

  public void testListenInPoolThreadUsesGivenExecutor() throws Exception {
    ExecutorService executorService = newCachedThreadPool(
View Full Code Here

Examples of com.google.common.util.concurrent.FuturesTest.SingleCallListener.wasCalled()

    SingleCallListener singleCallListener = new SingleCallListener();
    singleCallListener.expectCall();

    assertFalse(spy.wasExecuted);
    assertFalse(singleCallListener.wasCalled());
    assertFalse(listenableFuture.isDone());

    listenableFuture.addListener(singleCallListener, executorService);
    abstractFuture.set(DATA1);
    assertEquals(DATA1, listenableFuture.get());
View Full Code Here

Examples of com.google.common.util.concurrent.FuturesTest.SingleCallListener.wasCalled()

    abstractFuture.set(DATA1);
    assertEquals(DATA1, listenableFuture.get());
    singleCallListener.waitForCall();

    assertTrue(spy.wasExecuted);
    assertTrue(singleCallListener.wasCalled());
    assertTrue(listenableFuture.isDone());
  }

  public void testListenInPoolThreadCustomExecutorInterrupted()
      throws Exception {
View Full Code Here

Examples of com.google.common.util.concurrent.FuturesTest.SingleCallListener.wasCalled()

        listenInPoolThread(abstractFuture, executorService);

    SingleCallListener singleCallListener = new SingleCallListener();
    singleCallListener.expectCall();

    assertFalse(singleCallListener.wasCalled());
    assertFalse(listenableFuture.isDone());

    listenableFuture.addListener(singleCallListener, directExecutor());
    /*
     * Don't shut down until the listenInPoolThread task has been accepted to
View Full Code Here

Examples of com.google.common.util.concurrent.FuturesTest.SingleCallListener.wasCalled()

    executorService.shutdownNow();
    abstractFuture.set(DATA1);
    assertEquals(DATA1, listenableFuture.get());
    singleCallListener.waitForCall();

    assertTrue(singleCallListener.wasCalled());
    assertTrue(listenableFuture.isDone());
  }

  /**
   * A Future that doesn't implement ListenableFuture, useful for testing
View Full Code Here

Examples of com.google.common.util.concurrent.FuturesTest.SingleCallListener.wasCalled()

    SingleCallListener singleCallListener = new SingleCallListener();
    singleCallListener.expectCall();

    assertFalse(spy.wasExecuted);
    assertFalse(singleCallListener.wasCalled());
    assertTrue(listenableFuture.isDone()); // We call AbstractFuture#set above.

    // #addListener() will run the listener immediately because the Future is
    // already finished (we explicitly set the result of it above).
    listenableFuture.addListener(singleCallListener, sameThreadExecutor());
View Full Code Here

Examples of com.google.common.util.concurrent.FuturesTest.SingleCallListener.wasCalled()

    assertEquals(DATA1, listenableFuture.get());

    // 'spy' should have been ignored since 'abstractFuture' was done before
    // a listener was added.
    assertFalse(spy.wasExecuted);
    assertTrue(singleCallListener.wasCalled());
    assertTrue(listenableFuture.isDone());
  }

  public void testListenInPoolThreadUsesGivenExecutor() throws Exception {
    ExecutorService executorService = newCachedThreadPool(
View Full Code Here

Examples of com.google.common.util.concurrent.FuturesTest.SingleCallListener.wasCalled()

    SingleCallListener singleCallListener = new SingleCallListener();
    singleCallListener.expectCall();

    assertFalse(spy.wasExecuted);
    assertFalse(singleCallListener.wasCalled());
    assertFalse(listenableFuture.isDone());

    listenableFuture.addListener(singleCallListener, executorService);
    abstractFuture.set(DATA1);
    assertEquals(DATA1, listenableFuture.get());
View Full Code Here

Examples of com.google.common.util.concurrent.FuturesTest.SingleCallListener.wasCalled()

    abstractFuture.set(DATA1);
    assertEquals(DATA1, listenableFuture.get());
    singleCallListener.waitForCall();

    assertTrue(spy.wasExecuted);
    assertTrue(singleCallListener.wasCalled());
    assertTrue(listenableFuture.isDone());
  }

  /**
   * A Future that doesn't implement ListenableFuture, useful for testing
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.