@SafeVarargs
    public static void rethrowFromCollection(Collection<?> values, Class<? extends Throwable> ... ignored) throws Throwable {
        outerLoop:
        for (Object value : values) {
            if (value instanceof Throwable throwable) {
                for (Class<? extends Throwable> ignoredClass : ignored) {
                    if (ignoredClass.isAssignableFrom(value.getClass())) {
                        continue outerLoop;
                    }
                }
                throw throwable;
            }
        }
    }
@Test
    public void testRethrowFromCollection_when_notIgnoredThrowableOnList_then_isRethrown() {
        assertThatExceptionOfType(TestException.class)
                .isThrownBy(() -> rethrowFromCollection(Collections.singleton(new TestException())));
        assertThatExceptionOfType(TestException.class)
                .isThrownBy(() -> rethrowFromCollection(Collections.singleton(new TestException()), NullPointerException.class));
        assertThatExceptionOfType(TestException.class)
                .isThrownBy(() -> rethrowFromCollection(asList(new NullPointerException(), new TestException()), NullPointerException.class));
    }