@Test public void testIfCancelled_exception() {

  AtomicReference<CancellationException> cancelled = new AtomicReference<>();
  CompletableFuture<String> future = new CompletableFuture<>();
  future.completeExceptionally(new RuntimeException());
  Utils.ifCancelled(future, cancelled::set);
  assertThat(cancelled.get()).isNull();
}