public static boolean isOrHasCause(Throwable t, Class<?> classToFind) {
        while (t != null && t.getCause() != t && !classToFind.isAssignableFrom(t.getClass())) {
            t = t.getCause();
        }
        return t != null && classToFind.isAssignableFrom(t.getClass());
    }
@Test
    public void test_isOrHasCause_when_noMatch_then_false() {
        Throwable throwable = new Exception();
        for (int i = 0; i < 10; i++) {
            throwable = new Exception(throwable);
        }
        assertFalse(isOrHasCause(throwable, TargetNotMemberException.class));
    }