4028 |
|
} |
4029 |
|
|
4030 |
|
/** |
4031 |
+ |
* minimalStage.toCompletableFuture() returns a CompletableFuture that |
4032 |
+ |
* is completed normally, with the same value, when source is. |
4033 |
+ |
*/ |
4034 |
+ |
public void testMinimalCompletionStage_toCompletableFuture_normalCompletion() { |
4035 |
+ |
for (boolean createIncomplete : new boolean[] { true, false }) |
4036 |
+ |
for (Integer v1 : new Integer[] { 1, null }) |
4037 |
+ |
{ |
4038 |
+ |
CompletableFuture<Integer> f = new CompletableFuture<>(); |
4039 |
+ |
CompletionStage<Integer> minimal = f.minimalCompletionStage(); |
4040 |
+ |
if (!createIncomplete) assertTrue(f.complete(v1)); |
4041 |
+ |
CompletableFuture<Integer> g = minimal.toCompletableFuture(); |
4042 |
+ |
if (createIncomplete) { |
4043 |
+ |
checkIncomplete(f); |
4044 |
+ |
checkIncomplete(g); |
4045 |
+ |
assertTrue(f.complete(v1)); |
4046 |
+ |
} |
4047 |
+ |
checkCompletedNormally(f, v1); |
4048 |
+ |
checkCompletedNormally(g, v1); |
4049 |
+ |
}} |
4050 |
+ |
|
4051 |
+ |
/** |
4052 |
|
* minimalStage.toCompletableFuture() gives mutable CompletableFuture |
4053 |
|
*/ |
4054 |
|
public void testMinimalCompletionStage_toCompletableFuture_mutable() { |