@Test
public void getCauses() {

    // null
    assertTrue(ExceptionUtil.getCauses(null).isEmpty());
    // 1 exception
    List<Throwable> es = ExceptionUtil.getCauses(new IOException());
    assertEquals(1, es.size());
    Iterator<Throwable> i = es.iterator();
    assertThat(i.next(), instanceOf(IOException.class));
    // 3 exceptions
    es = ExceptionUtil.getCauses(getException());
    assertEquals(3, es.size());
    i = es.iterator();
    assertThat(i.next(), instanceOf(IOException.class));
    assertThat(i.next(), instanceOf(IllegalArgumentException.class));
    assertThat(i.next(), instanceOf(IllegalStateException.class));
    // 3 exceptions
    es = ExceptionUtil.getCauses(getException(), false);
    assertEquals(3, es.size());
    i = es.iterator();
    assertThat(i.next(), instanceOf(IOException.class));
    assertThat(i.next(), instanceOf(IllegalArgumentException.class));
    assertThat(i.next(), instanceOf(IllegalStateException.class));
}