|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object junit.framework.Assert junit.framework.TestCase com.google.common.util.concurrent.testing.AbstractListenableFutureTest
@Beta public abstract class AbstractListenableFutureTest
Abstract test case parent for anything implementing ListenableFuture
.
Tests the two get methods and the addListener method.
Field Summary | |
---|---|
protected ListenableFuture<Boolean> |
future
|
protected CountDownLatch |
latch
|
Constructor Summary | |
---|---|
AbstractListenableFutureTest()
|
Method Summary | ||
---|---|---|
protected abstract
|
createListenableFuture(V value,
Exception except,
CountDownLatch waitOn)
Constructs a listenable future with a value available after the latch has counted down. |
|
protected void |
setUp()
|
|
protected void |
tearDown()
|
|
void |
testAllListenersCompleteSuccessfully()
Tests that all listeners complete, even if they were added before or after the future was finishing. |
|
void |
testCanceledFutureThrowsCancellation()
Tests that a canceled future throws a cancellation exception. |
|
void |
testGetBlocksUntilValueAvailable()
Tests that the Future.get() method blocks until a value is
available. |
|
void |
testListenersNotifiedOnError()
|
|
void |
testTimeoutOnGetWorksCorrectly()
Tests that the Future.get(long, TimeUnit) method times out
correctly. |
Methods inherited from class junit.framework.TestCase |
---|
countTestCases, createResult, getName, run, run, runBare, runTest, setName, toString |
Methods inherited from class junit.framework.Assert |
---|
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, failNotEquals, failNotSame, failSame, format |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected CountDownLatch latch
protected ListenableFuture<Boolean> future
Constructor Detail |
---|
public AbstractListenableFutureTest()
Method Detail |
---|
protected void setUp() throws Exception
setUp
in class junit.framework.TestCase
Exception
protected void tearDown() throws Exception
tearDown
in class junit.framework.TestCase
Exception
protected abstract <V> ListenableFuture<V> createListenableFuture(V value, Exception except, CountDownLatch waitOn)
public void testGetBlocksUntilValueAvailable() throws Throwable
Future.get()
method blocks until a value is
available.
Throwable
public void testTimeoutOnGetWorksCorrectly() throws InterruptedException, ExecutionException
Future.get(long, TimeUnit)
method times out
correctly.
InterruptedException
ExecutionException
public void testCanceledFutureThrowsCancellation() throws Exception
Exception
public void testListenersNotifiedOnError() throws Exception
Exception
public void testAllListenersCompleteSuccessfully() throws InterruptedException, ExecutionException
InterruptedException
ExecutionException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |