Home | History | Annotate | Download | only in testing

Lines Matching defs:future

29 import java.util.concurrent.Future;
44 protected ListenableFuture<Boolean> future;
49 // Create a latch and a future that waits on the latch.
51 future = createListenableFuture(Boolean.TRUE, null, latch);
62 * Constructs a listenable future with a value available after the latch
69 * Tests that the {@link Future#get()} method blocks until a value is
74 assertFalse(future.isDone());
75 assertFalse(future.isCancelled());
80 // Wait on the future in a separate thread.
85 assertSame(Boolean.TRUE, future.get());
93 // Release the future value.
102 assertTrue(future.isDone());
103 assertFalse(future.isCancelled());
107 * Tests that the {@link Future#get(long, TimeUnit)} method times out
115 future.get(20, TimeUnit.MILLISECONDS);
125 * Tests that a canceled future throws a cancellation exception.
131 assertFalse(future.isDone());
132 assertFalse(future.isCancelled());
141 future.get();
150 assertFalse(future.isDone());
151 assertFalse(future.isCancelled());
153 future.cancel(true);
155 assertTrue(future.isDone());
156 assertTrue(future.isCancelled());
169 future.addListener(new Runnable() {
180 future.get();
189 future.cancel(true);
191 assertTrue(future.isCancelled());
192 assertTrue(future.isDone());
205 * the future was finishing. Also acts as a concurrency test to make sure the
206 * locking is done correctly when a future is finishing so that no listeners
231 future.addListener(new Runnable() {
239 assertSame(Boolean.TRUE, future.get());