@Test public void testIterator() { Throwable t1 = new Throwable(); Throwable t2 = new Throwable(); SQLException e1 = new SQLException(t1); SQLException e2 = new SQLException(t2); e1.setNextException(e2); List<Throwable> list = Lists.newArrayList(e1); assertThat(list.get(0)).isEqualTo(e1); assertThat(list.get(1)).isEqualTo(t1); assertThat(list.get(2)).isEqualTo(e2); assertThat(list.get(3)).isEqualTo(t2); }
@Override public Iterator<Throwable> iterator() { return new SQLExceptionIterator(this); }
SQLException extends Exception implements Iterable<Throwable> { @Override public Iterator<Throwable> iterator() { return new SQLExceptionIterator(this); } }
SQLException extends Exception implements Iterable<Throwable> { @Override public Iterator<Throwable> iterator() { return new SQLExceptionIterator(this); } SQLException(String message, @Nullable String sqlState, int errorCode);  SQLException(String message, @Nullable String sqlState);  SQLException(String message);  SQLException();  SQLException(@Nullable Throwable cause);  SQLException(String message, @Nullable Throwable cause);  SQLException(String message, @Nullable String sqlState, @Nullable Throwable cause);  SQLException(String message, @Nullable String sqlState, int errorCode,
            @Nullable Throwable cause); }
SQLException extends Exception implements Iterable<Throwable> { @Override public Iterator<Throwable> iterator() { return new SQLExceptionIterator(this); } SQLException(String message, @Nullable String sqlState, int errorCode);  SQLException(String message, @Nullable String sqlState);  SQLException(String message);  SQLException();  SQLException(@Nullable Throwable cause);  SQLException(String message, @Nullable Throwable cause);  SQLException(String message, @Nullable String sqlState, @Nullable Throwable cause);  SQLException(String message, @Nullable String sqlState, int errorCode,
            @Nullable Throwable cause); @Nullable String getSQLState(); int getErrorCode(); @Nullable SQLException getNextException(); void setNextException(SQLException exception); @Override Iterator<Throwable> iterator(); }
SQLException extends Exception implements Iterable<Throwable> { @Override public Iterator<Throwable> iterator() { return new SQLExceptionIterator(this); } SQLException(String message, @Nullable String sqlState, int errorCode);  SQLException(String message, @Nullable String sqlState);  SQLException(String message);  SQLException();  SQLException(@Nullable Throwable cause);  SQLException(String message, @Nullable Throwable cause);  SQLException(String message, @Nullable String sqlState, @Nullable Throwable cause);  SQLException(String message, @Nullable String sqlState, int errorCode,
            @Nullable Throwable cause); @Nullable String getSQLState(); int getErrorCode(); @Nullable SQLException getNextException(); void setNextException(SQLException exception); @Override Iterator<Throwable> iterator();  }