void () { Throwable exc = new RuntimeException("exc", new RuntimeException("exc-cause", new IllegalStateException("exc-cause-cause"))); exc.addSuppressed(new RuntimeException("exc-suppressed")); exc.getCause().addSuppressed(new IllegalStateException("exc-cause-suppressed")); Assertions .assertThat(ContainerUtil.map(ExceptionUtil.findCauseAndSuppressed(exc, Throwable.class), Throwable::getMessage)) .containsExactly("exc", "exc-cause", "exc-cause-cause", "exc-suppressed", "exc-cause-suppressed"); Assertions .assertThat(ContainerUtil.map(ExceptionUtil.findCauseAndSuppressed(exc, IllegalStateException.class), Throwable::getMessage)) .containsExactly("exc-cause-cause", "exc-cause-suppressed"); }