@Test public void testCreationWithArrays() { CompositeException ce1 = new CompositeException(IAE, IO, OUPS); CompositeException ce2 = new CompositeException(IO, IAE, OUPS); assertThat(ce1).hasMessageContaining("iae").hasMessageContaining("io").hasMessageContaining("oups"); assertThat(ce1).getCause().isEqualTo(IAE); assertThat(ce2).getCause().isEqualTo(IO); assertThat(ce1.getCauses()).containsExactly(IAE, IO, OUPS); assertThat(ce1.getSuppressed()).containsExactly(IO, OUPS); assertThat(ce2.getCauses()).containsExactly(IO, IAE, OUPS); assertThat(ce2.getSuppressed()).containsExactly(IAE, OUPS); CompositeException ce3 = new CompositeException(OUPS); assertThat(ce3).hasMessageContaining("oups"); assertThat(ce3.getCauses()).containsExactly(OUPS); assertThat(ce3.getCause()).isEqualTo(OUPS); assertThat(ce3.getSuppressed()).isEmpty(); }
public List<Throwable> getCauses() { List<Throwable> causes = new ArrayList<>(); causes.add(getCause()); causes.addAll(Arrays.asList(getSuppressed())); return causes; }
CompositeException extends RuntimeException { public List<Throwable> getCauses() { List<Throwable> causes = new ArrayList<>(); causes.add(getCause()); causes.addAll(Arrays.asList(getSuppressed())); return causes; } }
CompositeException extends RuntimeException { public List<Throwable> getCauses() { List<Throwable> causes = new ArrayList<>(); causes.add(getCause()); causes.addAll(Arrays.asList(getSuppressed())); return causes; } CompositeException(List<Throwable> causes);  CompositeException(Throwable... causes);  CompositeException(CompositeException other, Throwable toBeAppended); }
CompositeException extends RuntimeException { public List<Throwable> getCauses() { List<Throwable> causes = new ArrayList<>(); causes.add(getCause()); causes.addAll(Arrays.asList(getSuppressed())); return causes; } CompositeException(List<Throwable> causes);  CompositeException(Throwable... causes);  CompositeException(CompositeException other, Throwable toBeAppended); @Override String getMessage(); List<Throwable> getCauses(); }
CompositeException extends RuntimeException { public List<Throwable> getCauses() { List<Throwable> causes = new ArrayList<>(); causes.add(getCause()); causes.addAll(Arrays.asList(getSuppressed())); return causes; } CompositeException(List<Throwable> causes);  CompositeException(Throwable... causes);  CompositeException(CompositeException other, Throwable toBeAppended); @Override String getMessage(); List<Throwable> getCauses();  }