public static void checkAllDone(Collection<Future<?>> futures) throws Exception {
        for (Future<?> f : futures) {
            if (f.isDone()) {
                f.get();
            }
        }
    }
@Test
    public void testGetAllDoneThrowsException_whenSomeFutureHasException() {
        InterruptedException exception = new InterruptedException();
        Collection<Future<?>> futures = List.of(InternalCompletableFuture.completedExceptionally(exception));
        // the future is completedExceptionally with an InterruptedException (thread was not
        // interrupted during future.get()), so it is normal to expect
        // InterruptedException wrapped within an ExecutionException.
        assertThatThrownBy(() -> FutureUtil.checkAllDone(futures))
                .isInstanceOf(ExecutionException.class)
                .cause().has(rootCause(InterruptedException.class));
    }