### Question:
CompositeException extends RuntimeException { @Override public String getMessage() { return message; } CompositeException(Throwable... exceptions);  CompositeException(Iterable<? extends Throwable> errors); List<Throwable> getExceptions(); @Override String getMessage(); @Override synchronized Throwable getCause(); @Override void printStackTrace(); @Override void printStackTrace(PrintStream s); @Override void printStackTrace(PrintWriter s); int size();  }### Answer:
@Test public void testEmptyErrors() { try { new CompositeException(); fail("CompositeException should fail if errors is empty"); } catch (IllegalArgumentException e) { assertEquals("errors is empty", e.getMessage()); } try { new CompositeException(new ArrayList<Throwable>()); fail("CompositeException should fail if errors is empty"); } catch (IllegalArgumentException e) { assertEquals("errors is empty", e.getMessage()); } }
@Test public void messageCollection() { CompositeException compositeException = new CompositeException(ex1, ex3); assertEquals("2 exceptions occurred. ", compositeException.getMessage()); }
@Test public void messageVarargs() { CompositeException compositeException = new CompositeException(ex1, ex2, ex3); assertEquals("3 exceptions occurred. ", compositeException.getMessage()); }