Class AbstractCheckedFutureTest
- java.lang.Object
-
- junit.framework.Assert
-
- junit.framework.TestCase
-
- com.google.common.util.concurrent.testing.AbstractListenableFutureTest
-
- com.google.common.util.concurrent.testing.AbstractCheckedFutureTest
-
- All Implemented Interfaces:
junit.framework.Test
@Beta @GwtIncompatible public abstract class AbstractCheckedFutureTest extends AbstractListenableFutureTest
Test case to make sure theCheckedFuture.checkedGet()
andCheckedFuture.checkedGet(long, TimeUnit)
methods work correctly.- Since:
- 10.0
-
-
Field Summary
-
Fields inherited from class com.google.common.util.concurrent.testing.AbstractListenableFutureTest
future, latch
-
-
Constructor Summary
Constructors Constructor Description AbstractCheckedFutureTest()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract void
checkCancelledException(java.lang.Exception e)
Checks that the exception is the correct type of cancellation exception.protected abstract void
checkExecutionException(java.lang.Exception e)
Checks that the exception is the correct type of execution exception.protected abstract void
checkInterruptedException(java.lang.Exception e)
Checks that the exception is the correct type of interruption exception.protected abstract <V> CheckedFuture<V,?>
createCheckedFuture(V value, java.lang.Exception except, java.util.concurrent.CountDownLatch waitOn)
More specific type for the create method.protected <V> ListenableFuture<V>
createListenableFuture(V value, java.lang.Exception except, java.util.concurrent.CountDownLatch waitOn)
Constructs a listenable future with a value available after the latch has counted down.void
testCheckedGetThrowsApplicationExceptionOnCancellation()
Tests that theCheckedFuture.checkedGet()
method throws the correct type of cancellation exception when it is cancelled.void
testCheckedGetThrowsApplicationExceptionOnError()
void
testCheckedGetThrowsApplicationExceptionOnInterruption()
-
Methods inherited from class com.google.common.util.concurrent.testing.AbstractListenableFutureTest
setUp, tearDown, testAllListenersCompleteSuccessfully, testCanceledFutureThrowsCancellation, testGetBlocksUntilValueAvailable, testListenersNotifiedOnError, testTimeoutOnGetWorksCorrectly
-
Methods inherited from class junit.framework.TestCase
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, countTestCases, createResult, fail, fail, failNotEquals, failNotSame, failSame, format, getName, run, run, runBare, runTest, setName, toString
-
-
-
-
Method Detail
-
createCheckedFuture
protected abstract <V> CheckedFuture<V,?> createCheckedFuture(V value, java.lang.Exception except, java.util.concurrent.CountDownLatch waitOn)
More specific type for the create method.
-
checkCancelledException
protected abstract void checkCancelledException(java.lang.Exception e)
Checks that the exception is the correct type of cancellation exception.
-
checkExecutionException
protected abstract void checkExecutionException(java.lang.Exception e)
Checks that the exception is the correct type of execution exception.
-
checkInterruptedException
protected abstract void checkInterruptedException(java.lang.Exception e)
Checks that the exception is the correct type of interruption exception.
-
createListenableFuture
protected <V> ListenableFuture<V> createListenableFuture(V value, java.lang.Exception except, java.util.concurrent.CountDownLatch waitOn)
Description copied from class:AbstractListenableFutureTest
Constructs a listenable future with a value available after the latch has counted down.- Specified by:
createListenableFuture
in classAbstractListenableFutureTest
-
testCheckedGetThrowsApplicationExceptionOnCancellation
public void testCheckedGetThrowsApplicationExceptionOnCancellation()
Tests that theCheckedFuture.checkedGet()
method throws the correct type of cancellation exception when it is cancelled.
-
testCheckedGetThrowsApplicationExceptionOnInterruption
public void testCheckedGetThrowsApplicationExceptionOnInterruption() throws java.lang.InterruptedException
- Throws:
java.lang.InterruptedException
-
testCheckedGetThrowsApplicationExceptionOnError
public void testCheckedGetThrowsApplicationExceptionOnError()
-
-