File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed
src/test/java/scala/compat/java8 Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -354,7 +354,7 @@ public void testToJavaToCompletableFutureDoesNotMutateUnderlyingPromise() throws
354354 }
355355
356356 @ Test
357- public void testToJavaToCompletableFutureJavaCompleteCallledAfterScalaComplete () throws ExecutionException , InterruptedException {
357+ public void testToJavaToCompletableFutureJavaCompleteCalledAfterScalaComplete () throws ExecutionException , InterruptedException {
358358 final Promise <String > p = promise ();
359359 Future <String > sf = p .future ();
360360 final CompletionStage <String > cs = toJava (sf );
@@ -365,4 +365,17 @@ public void testToJavaToCompletableFutureJavaCompleteCallledAfterScalaComplete()
365365 cf .complete ("javadone" );
366366 assertEquals ("scaladone" , cf .get ());
367367 }
368+
369+ @ Test
370+ public void testToJavaToCompletableFutureJavaCompleteCalledBeforeScalaComplete () throws ExecutionException , InterruptedException {
371+ final Promise <String > p = promise ();
372+ Future <String > sf = p .future ();
373+ final CompletionStage <String > cs = toJava (sf );
374+ CompletableFuture <String > cf = cs .toCompletableFuture ();
375+ assertEquals ("notyet" , cf .getNow ("notyet" ));
376+ cf .complete ("javadone" );
377+ assertEquals ("javadone" , cf .get ());
378+ p .success ("scaladone" );
379+ assertEquals ("javadone" , cf .get ());
380+ }
368381}
You can’t perform that action at this time.
0 commit comments