@Test
public void testCallSetNextExceptionMultipleTimesOnSameSQLException() {

    Throwable t1 = new Throwable();
    Throwable t2 = new Throwable();
    Throwable t3 = new Throwable();
    SQLException e1 = new SQLException(t1);
    SQLException e2 = new SQLException(t2);
    SQLException e3 = new SQLException(t3);
    e1.setNextException(e2);
    e1.setNextException(e3);
    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);
    assertThat(list.get(4)).isEqualTo(e3);
    assertThat(list.get(5)).isEqualTo(t3);
}