Skip to content

Commit a215961

Browse files
committed
moar code tweaks - code coverage
1 parent d30bf05 commit a215961

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

src/test/groovy/graphql/execution/AsyncTest.groovy

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff 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)

0 commit comments

Comments
 (0)