com.google.common.util.concurrent.testing
Class AbstractCheckedFutureTest

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by com.google.common.util.concurrent.testing.AbstractListenableFutureTest
              extended by com.google.common.util.concurrent.testing.AbstractCheckedFutureTest
All Implemented Interfaces:
junit.framework.Test

@Beta
public abstract class AbstractCheckedFutureTest
extends AbstractListenableFutureTest

Test case to make sure the CheckedFuture.checkedGet() and CheckedFuture.checkedGet(long, TimeUnit) methods work correctly.

Since:
10.0
Author:
Sven Mawson

Field Summary
 
Fields inherited from class com.google.common.util.concurrent.testing.AbstractListenableFutureTest
future, latch
 
Constructor Summary
AbstractCheckedFutureTest()
           
 
Method Summary
protected abstract  void checkCancelledException(Exception e)
          Checks that the exception is the correct type of cancellation exception.
protected abstract  void checkExecutionException(Exception e)
          Checks that the exception is the correct type of execution exception.
protected abstract  void checkInterruptedException(Exception e)
          Checks that the exception is the correct type of interruption exception.
protected abstract
<V> CheckedFuture<V,?>
createCheckedFuture(V value, Exception except, CountDownLatch waitOn)
          More specific type for the create method.
protected
<V> ListenableFuture<V>
createListenableFuture(V value, Exception except, CountDownLatch waitOn)
          Constructs a listenable future with a value available after the latch has counted down.
 void testCheckedGetThrowsApplicationExceptionOnCancellation()
          Tests that the CheckedFuture.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
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
 

Constructor Detail

AbstractCheckedFutureTest

public AbstractCheckedFutureTest()
Method Detail

createCheckedFuture

protected abstract <V> CheckedFuture<V,?> createCheckedFuture(V value,
                                                              Exception except,
                                                              CountDownLatch waitOn)
More specific type for the create method.


checkCancelledException

protected abstract void checkCancelledException(Exception e)
Checks that the exception is the correct type of cancellation exception.


checkExecutionException

protected abstract void checkExecutionException(Exception e)
Checks that the exception is the correct type of execution exception.


checkInterruptedException

protected abstract void checkInterruptedException(Exception e)
Checks that the exception is the correct type of interruption exception.


createListenableFuture

protected <V> ListenableFuture<V> createListenableFuture(V value,
                                                         Exception except,
                                                         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 class AbstractListenableFutureTest

testCheckedGetThrowsApplicationExceptionOnCancellation

public void testCheckedGetThrowsApplicationExceptionOnCancellation()
Tests that the CheckedFuture.checkedGet() method throws the correct type of cancellation exception when it is cancelled.


testCheckedGetThrowsApplicationExceptionOnInterruption

public void testCheckedGetThrowsApplicationExceptionOnInterruption()
                                                            throws InterruptedException
Throws:
InterruptedException

testCheckedGetThrowsApplicationExceptionOnError

public void testCheckedGetThrowsApplicationExceptionOnError()


Copyright © 2010-2012. All Rights Reserved.