public class CompletableFutureTest extends JSR166TestCase
JSR166TestCase.AdjustablePolicy, JSR166TestCase.CallableOne, JSR166TestCase.CheckedBarrier, JSR166TestCase.CheckedCallable<T>, JSR166TestCase.CheckedInterruptedCallable<T>, JSR166TestCase.CheckedInterruptedRunnable, JSR166TestCase.CheckedRecursiveAction, JSR166TestCase.CheckedRecursiveTask<T>, JSR166TestCase.CheckedRunnable, JSR166TestCase.LongPossiblyInterruptedRunnable, JSR166TestCase.MediumInterruptedRunnable, JSR166TestCase.MediumPossiblyInterruptedRunnable, JSR166TestCase.MediumRunnable, JSR166TestCase.NoOpCallable, JSR166TestCase.NoOpREHandler, JSR166TestCase.NoOpRunnable, JSR166TestCase.NPETask, JSR166TestCase.RunnableShouldThrow, JSR166TestCase.ShortInterruptedRunnable, JSR166TestCase.ShortRunnable, JSR166TestCase.SimpleThreadFactory, JSR166TestCase.SmallCallable, JSR166TestCase.SmallPossiblyInterruptedRunnable, JSR166TestCase.SmallRunnable, JSR166TestCase.StringTask, JSR166TestCase.ThreadShouldThrow, JSR166TestCase.TrackedCallable, JSR166TestCase.TrackedLongRunnable, JSR166TestCase.TrackedMediumRunnable, JSR166TestCase.TrackedNoOpRunnable, JSR166TestCase.TrackedRunnable, JSR166TestCase.TrackedShortRunnable, JSR166TestCase.TrackedSmallRunnable
eight, expensiveTests, five, four, JAVA_CLASS_VERSION, JAVA_SPECIFICATION_VERSION, LONG_DELAY_MS, m1, m10, m2, m3, m4, m5, m6, MEDIUM_DELAY_MS, nine, one, seven, SHORT_DELAY_MS, six, SIZE, SMALL_DELAY_MS, TEST_STRING, testImplementationDetails, three, two, zero
Constructor and Description |
---|
CompletableFutureTest() |
Modifier and Type | Method and Description |
---|---|
void |
testAcceptEither_actionFailed()
acceptEither result completes exceptionally if action does
|
void |
testAcceptEither_exceptionalCompletion()
acceptEither result completes exceptionally after exceptional
completion of either source
|
void |
testAcceptEither_exceptionalCompletion2() |
void |
testAcceptEither_normalCompletion()
acceptEither result completes normally after normal completion
of either source
|
void |
testAcceptEither_sourceCancelled()
acceptEither result completes exceptionally if either source cancelled
|
void |
testAdditiveMonad()
CompletableFuture is an additive monad - sort of.
|
void |
testAllOf_backwards() |
void |
testAllOf_empty()
allOf(no component futures) returns a future completed normally
with the value null
|
void |
testAllOf_exceptional() |
void |
testAllOf_normal()
allOf returns a future completed normally with the value null
when all components complete normally
|
void |
testAnyOf_empty()
anyOf(no component futures) returns an incomplete future
|
void |
testAnyOf_exceptional_backwards() |
void |
testAnyOf_exceptional()
anyOf result completes exceptionally when any component does.
|
void |
testAnyOf_normal_backwards() |
void |
testAnyOf_normal()
anyOf returns a future completed normally with a value when
a component future does
|
void |
testApplyToEither_actionFailed()
applyToEither result completes exceptionally if action does
|
void |
testApplyToEither_exceptionalCompletion()
applyToEither result completes exceptionally after exceptional
completion of either source
|
void |
testApplyToEither_exceptionalCompletion2() |
void |
testApplyToEither_normalCompletion()
applyToEither result completes normally after normal completion
of either source
|
void |
testApplyToEither_sourceCancelled()
applyToEither result completes exceptionally if either source cancelled
|
void |
testApplyToEither_sourceCancelled2() |
void |
testCancel()
cancel completes exceptionally and reports cancelled, as indicated by
methods isDone, isCancelled, join, get, and getNow
|
void |
testComplete()
complete completes normally, as indicated by methods isDone,
isCancelled, join, get, and getNow
|
void |
testCompleteAsync()
completeAsync completes with value of given supplier
|
void |
testCompleteAsync2()
completeAsync completes exceptionally if given supplier throws
|
void |
testCompleteAsync3()
completeAsync with given executor completes with value of given supplier
|
void |
testCompleteAsync4()
completeAsync with given executor completes exceptionally if
given supplier throws
|
void |
testCompletedFuture()
completedFuture returns a completed CompletableFuture with given value
|
void |
testCompletedStage()
completedStage returns a completed CompletionStage
|
void |
testCompleteExceptionally()
completeExceptionally completes exceptionally, as indicated by
methods isDone, isCancelled, join, get, and getNow
|
void |
testCompleteOnTimeout_completed()
completeOnTimeout has no effect if completed within timeout
|
void |
testCompleteOnTimeout_timesOut()
completeOnTimeout completes with given value if not complete
|
void |
testCompleteOnTimeout_timesOut(Integer v) |
void |
testConstructor()
A newly constructed CompletableFuture is incomplete, as indicated
by methods isDone, isCancelled, and getNow
|
void |
testCopy()
copy returns a CompletableFuture that is completed normally,
with the same value, when source is.
|
void |
testCopy2()
copy returns a CompletableFuture that is completed exceptionally
when source is.
|
void |
testDefaultExecutor()
defaultExecutor by default returns the commonPool if
it supports more than one thread.
|
void |
testDelayedExecutor()
delayedExecutor returns an executor that delays submission
|
void |
testDelayedExecutor(Executor executor,
Integer v) |
void |
testExceptionally_exceptionalCompletion()
exceptionally action completes with function value on source
exception
|
void |
testExceptionally_exceptionalCompletionActionFailed()
If an "exceptionally action" throws an exception, it completes
exceptionally with that exception
|
void |
testExceptionally_normalCompletion()
exceptionally action is not invoked when source completes
normally, and source result is propagated
|
void |
testExceptionPropagationReusesResultObject() |
void |
testFailedFuture_null()
failedFuture(null) throws NPE
|
void |
testFailedFuture()
failedFuture returns a CompletableFuture completed
exceptionally with the given Exception
|
void |
testFailedStage()
failedStage returns a CompletionStage completed
exceptionally with the given Exception
|
void |
testGetNumberOfDependents()
getNumberOfDependents returns number of dependent tasks
|
void |
testHandle_exceptionalCompletion()
handle action completes normally with function value on
exceptional completion of source
|
void |
testHandle_normalCompletion()
handle action completes normally with function value on normal
completion of source
|
void |
testHandle_sourceCancelled()
handle action completes normally with function value on
cancelled source
|
void |
testHandle_sourceCompletedNormallyActionFailed()
If a "handle action" throws an exception when triggered by
a normal completion, it completes exceptionally
|
void |
testHandle_sourceFailedActionFailed()
If a "handle action" throws an exception when triggered by
a source completion that also throws an exception, the action
exception takes precedence (unlike whenComplete)
|
void |
testMinimalCompletionStage_minimality()
Minimal completion stages throw UOE for all non-CompletionStage methods
|
void |
testMinimalCompletionStage()
minimalCompletionStage returns a CompletableFuture that is
completed normally, with the same value, when source is.
|
void |
testMinimalCompletionStage2()
minimalCompletionStage returns a CompletableFuture that is
completed exceptionally when source is.
|
void |
testNewIncompleteFuture()
newIncompleteFuture returns an incomplete CompletableFuture
|
void |
testNPE()
Completion methods throw NullPointerException with null arguments
|
void |
testObtrudeException()
obtrudeException forces completion with given exception
|
void |
testObtrudeValue()
obtrudeValue forces completion with given value
|
void |
testOrTimeout_completed()
orTimeout completes normally if completed before timeout
|
void |
testOrTimeout_timesOut()
orTimeout completes with TimeoutException if not complete
|
void |
testRunAfterBoth_actionFailed()
runAfterBoth result completes exceptionally if action does
|
void |
testRunAfterBoth_exceptionalCompletion()
runAfterBoth result completes exceptionally after exceptional
completion of either source
|
void |
testRunAfterBoth_normalCompletion()
runAfterBoth result completes normally after normal
completion of sources
|
void |
testRunAfterBoth_sourceCancelled()
runAfterBoth result completes exceptionally if either source cancelled
|
void |
testRunAfterEither_actionFailed()
runAfterEither result completes exceptionally if action does
|
void |
testRunAfterEither_exceptionalCompletion()
runAfterEither result completes exceptionally after exceptional
completion of either source
|
void |
testRunAfterEither_exceptionalCompletion2() |
void |
testRunAfterEither_normalCompletion()
runAfterEither result completes normally after normal completion
of either source
|
void |
testRunAfterEither_sourceCancelled()
runAfterEither result completes exceptionally if either source cancelled
|
void |
testRunAsync_exceptionalCompletion()
failing runAsync completes exceptionally after running Runnable
|
void |
testRunAsync_normalCompletion()
runAsync completes after running Runnable
|
void |
testSupplyAsync_exceptionalCompletion()
Failing supplyAsync completes exceptionally
|
void |
testSupplyAsync_normalCompletion()
supplyAsync completes with result of supplier
|
void |
testThenAccept_actionFailed()
thenAccept result completes exceptionally if action does
|
void |
testThenAccept_exceptionalCompletion()
thenAccept result completes exceptionally after exceptional
completion of source
|
void |
testThenAccept_normalCompletion()
thenAccept result completes normally after normal completion of source
|
void |
testThenAccept_sourceCancelled()
thenAccept result completes exceptionally if source cancelled
|
void |
testThenAcceptBoth_actionFailed()
thenAcceptBoth result completes exceptionally if action does
|
void |
testThenAcceptBoth_exceptionalCompletion()
thenAcceptBoth result completes exceptionally after exceptional
completion of either source
|
void |
testThenAcceptBoth_normalCompletion()
thenAcceptBoth result completes normally after normal
completion of sources
|
void |
testThenAcceptBoth_sourceCancelled()
thenAcceptBoth result completes exceptionally if either source cancelled
|
void |
testThenApply_actionFailed()
thenApply result completes exceptionally if action does
|
void |
testThenApply_exceptionalCompletion()
thenApply result completes exceptionally after exceptional
completion of source
|
void |
testThenApply_normalCompletion()
thenApply result completes normally after normal completion of source
|
void |
testThenApply_sourceCancelled()
thenApply result completes exceptionally if source cancelled
|
void |
testThenCombine_actionFailed()
thenCombine result completes exceptionally if action does
|
void |
testThenCombine_exceptionalCompletion()
thenCombine result completes exceptionally after exceptional
completion of either source
|
void |
testThenCombine_normalCompletion()
thenCombine result completes normally after normal completion
of sources
|
void |
testThenCombine_sourceCancelled()
thenCombine result completes exceptionally if either source cancelled
|
void |
testThenCompose_actionFailed()
thenCompose result completes exceptionally if action does
|
void |
testThenCompose_actionReturnsFailingFuture()
thenCompose result completes exceptionally if the result of the action does
|
void |
testThenCompose_exceptionalCompletion()
thenCompose result completes exceptionally after exceptional
completion of source
|
void |
testThenCompose_normalCompletion()
thenCompose result completes normally after normal completion of source
|
void |
testThenCompose_sourceCancelled()
thenCompose result completes exceptionally if source cancelled
|
void |
testThenRun_actionFailed()
thenRun result completes exceptionally if action does
|
void |
testThenRun_exceptionalCompletion()
thenRun result completes exceptionally after exceptional
completion of source
|
void |
testThenRun_normalCompletion()
thenRun result completes normally after normal completion of source
|
void |
testThenRun_sourceCancelled()
thenRun result completes exceptionally if source cancelled
|
void |
testToCompletableFuture()
toCompletableFuture returns this CompletableFuture.
|
void |
testToString()
toString indicates current completion state
|
void |
testWhenComplete_exceptionalCompletion()
whenComplete action executes on exceptional completion, propagating
source result.
|
void |
testWhenComplete_normalCompletion()
whenComplete action executes on normal completion, propagating
source result.
|
void |
testWhenComplete_sourceCancelled()
whenComplete action executes on cancelled source, propagating
CancellationException.
|
void |
testWhenComplete_sourceCompletedNormallyActionFailed()
If a whenComplete action throws an exception when triggered by
a normal completion, it completes exceptionally
|
void |
testWhenComplete_sourceFailedActionFailed()
If a whenComplete action throws an exception when triggered by
a source completion that also throws an exception, the source
exception takes precedence (unlike handle)
|
addNamedTestClasses, assertIteratorExhausted, assertThrows, atLeastJava10, atLeastJava6, atLeastJava7, atLeastJava8, atLeastJava9, await, await, await, awaiter, countDowner, getShortDelay, jdk8ParameterizedTestSuite, latchAwaitingStringTask, newTestSuite, parameterizedTestSuite, permissivePolicy, possiblyInterruptedRunnable, runBare, runTest, runTestProfiled, runWithoutPermissions, runWithPermissions, runWithSecurityManagerWithPermissions, setDelays, setUp, shouldThrow, shouldThrow, tearDown, testMethodNames, threadAssertEquals, threadAssertEquals, threadAssertFalse, threadAssertNull, threadAssertSame, threadAssertTrue, threadFail, threadRecordFailure, threadShouldThrow, threadShouldThrow, threadUnexpectedException, trackedRunnable
public void testConstructor()
public void testComplete()
public void testCompleteExceptionally()
public void testCancel()
public void testObtrudeValue()
public void testObtrudeException()
public void testGetNumberOfDependents()
public void testToString()
public void testCompletedFuture()
public void testExceptionally_normalCompletion()
public void testExceptionally_exceptionalCompletion()
public void testExceptionally_exceptionalCompletionActionFailed()
public void testWhenComplete_normalCompletion()
public void testWhenComplete_exceptionalCompletion()
public void testWhenComplete_sourceCancelled()
public void testWhenComplete_sourceCompletedNormallyActionFailed()
public void testWhenComplete_sourceFailedActionFailed()
public void testHandle_normalCompletion()
public void testHandle_exceptionalCompletion()
public void testHandle_sourceCancelled()
public void testHandle_sourceCompletedNormallyActionFailed()
public void testHandle_sourceFailedActionFailed()
public void testRunAsync_normalCompletion()
public void testRunAsync_exceptionalCompletion()
public void testSupplyAsync_normalCompletion()
public void testSupplyAsync_exceptionalCompletion()
public void testThenRun_normalCompletion()
public void testThenRun_exceptionalCompletion()
public void testThenRun_sourceCancelled()
public void testThenRun_actionFailed()
public void testThenApply_normalCompletion()
public void testThenApply_exceptionalCompletion()
public void testThenApply_sourceCancelled()
public void testThenApply_actionFailed()
public void testThenAccept_normalCompletion()
public void testThenAccept_exceptionalCompletion()
public void testThenAccept_sourceCancelled()
public void testThenAccept_actionFailed()
public void testThenCombine_normalCompletion()
public void testThenCombine_exceptionalCompletion() throws Throwable
Throwable
public void testThenCombine_sourceCancelled() throws Throwable
Throwable
public void testThenCombine_actionFailed()
public void testThenAcceptBoth_normalCompletion()
public void testThenAcceptBoth_exceptionalCompletion() throws Throwable
Throwable
public void testThenAcceptBoth_sourceCancelled() throws Throwable
Throwable
public void testThenAcceptBoth_actionFailed()
public void testRunAfterBoth_normalCompletion()
public void testRunAfterBoth_exceptionalCompletion() throws Throwable
Throwable
public void testRunAfterBoth_sourceCancelled() throws Throwable
Throwable
public void testRunAfterBoth_actionFailed()
public void testApplyToEither_normalCompletion()
public void testApplyToEither_exceptionalCompletion()
public void testApplyToEither_exceptionalCompletion2()
public void testApplyToEither_sourceCancelled()
public void testApplyToEither_sourceCancelled2()
public void testApplyToEither_actionFailed()
public void testAcceptEither_normalCompletion()
public void testAcceptEither_exceptionalCompletion()
public void testAcceptEither_exceptionalCompletion2()
public void testAcceptEither_sourceCancelled()
public void testAcceptEither_actionFailed()
public void testRunAfterEither_normalCompletion()
public void testRunAfterEither_exceptionalCompletion()
public void testRunAfterEither_exceptionalCompletion2()
public void testRunAfterEither_sourceCancelled()
public void testRunAfterEither_actionFailed()
public void testThenCompose_normalCompletion()
public void testThenCompose_exceptionalCompletion()
public void testThenCompose_actionFailed()
public void testThenCompose_sourceCancelled()
public void testThenCompose_actionReturnsFailingFuture()
public void testAllOf_empty() throws Exception
Exception
public void testAllOf_normal() throws Exception
Exception
public void testAnyOf_empty() throws Exception
Exception
public void testAnyOf_normal() throws Exception
Exception
public void testAnyOf_normal_backwards() throws Exception
Exception
public void testAnyOf_exceptional() throws Exception
Exception
public void testAnyOf_exceptional_backwards() throws Exception
Exception
public void testNPE()
public void testToCompletableFuture()
public void testNewIncompleteFuture()
public void testCompletedStage()
public void testDefaultExecutor()
public void testFailedFuture()
public void testFailedFuture_null()
public void testCopy()
public void testCopy2()
public void testMinimalCompletionStage()
public void testMinimalCompletionStage2()
public void testFailedStage()
public void testCompleteAsync()
public void testCompleteAsync2()
public void testCompleteAsync3()
public void testCompleteAsync4()
public void testOrTimeout_timesOut()
public void testOrTimeout_completed()
public void testCompleteOnTimeout_timesOut()
public void testCompleteOnTimeout_timesOut(Integer v)
public void testCompleteOnTimeout_completed()
public void testDelayedExecutor()
public void testDelayedExecutor(Executor executor, Integer v) throws Exception
Exception
public void testExceptionPropagationReusesResultObject()
public void testMinimalCompletionStage_minimality()