public static boolean areExceptionsPresentInChain(Throwable error, Class ... types) {
        while (error != null) {
            for (Class type : types) {
                if (type.isInstance(error)) {
                    return true;
                }
            }
            error = error.getCause();
        }
        return false;
    }
@Test
    public void testAreExceptionsPresentInChain4() {
        assertTrue(Exceptions.areExceptionsPresentInChain(new IllegalArgumentException(new IllegalStateException()), UnsupportedOperationException.class, IllegalStateException.class));
    }