File tree Expand file tree Collapse file tree
src/test/groovy/graphql/execution Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -584,6 +584,23 @@ class AsyncTest extends Specification {
584584 list == [" A" ]
585585 }
586586
587+ def " await with cancelCF on single builder can return exceptions" () {
588+ when : " single builder with a completed CF"
589+ def cancelCF = new CompletableFuture<Void > ()
590+ def failing = new CompletableFuture<String > ()
591+ failing. completeExceptionally(new RuntimeException (" boom" ))
592+
593+ def asyncBuilder = Async . ofExpectedSize(1 )
594+ asyncBuilder. add(failing)
595+
596+ // make cancel happen soon but off thread
597+ offThreadRun({ -> cancelCF. complete(null ) })
598+ def list = asyncBuilder. await(cancelCF). join()
599+
600+ then : " result is exceptional"
601+ thrown(CompletionException )
602+ }
603+
587604 def " await with null cancelCF on single builder will return completed values" () {
588605 when : " single builder with a completed CF"
589606 def asyncBuilder = Async . ofExpectedSize(1 )
You can’t perform that action at this time.
0 commit comments