@Test public void testIfCancelled_cancelledWithInterruption() {

  AtomicReference<CancellationException> cancelled = new AtomicReference<>();
  CompletableFuture<String> future = new CompletableFuture<>();
  future.cancel(true);
  Utils.ifCancelled(future, cancelled::set);
  assertThat(cancelled.get()).isInstanceOf(CancellationException.class);
}