public static void rethrowIfFatalError(Throwable t) {
        if (isJvmFatalError(t)) {
            throw (Error) t;
        }
    }
@Test
    void testRethrowFatalError() {
        // fatal error is rethrown
        assertThatThrownBy(() -> ExceptionUtils.rethrowIfFatalError(new InternalError()))
                .isInstanceOf(InternalError.class);

        // non-fatal error is not rethrown
        ExceptionUtils.rethrowIfFatalError(new NoClassDefFoundError());
    }