@Test
public void causedBy() {

    // null
    assertFalse(ExceptionUtil.causedBy(null, Exception.class));
    // 1 exception
    assertTrue(ExceptionUtil.causedBy(new IOException(), IOException.class));
    assertTrue(ExceptionUtil.causedBy(new IOException(), Exception.class));
    // 3 exceptions
    assertTrue(ExceptionUtil.causedBy(getException(), IOException.class));
    assertTrue(ExceptionUtil.causedBy(getException(), IllegalArgumentException.class));
    assertTrue(ExceptionUtil.causedBy(getException(), IllegalStateException.class));
    assertTrue(ExceptionUtil.causedBy(getException(), RuntimeException.class));
    assertTrue(ExceptionUtil.causedBy(getException(), Exception.class));
    assertFalse(ExceptionUtil.causedBy(getException(), IllegalAccessException.class));
}