### Question:
EJBException extends RuntimeException { public String getMessage() { if (causeException == null) return super.getMessage(); StringBuilder sb = new StringBuilder(); if (super.getMessage() != null) { sb.append(super.getMessage()); sb.append("; "); } sb.append("nested exception is: "); sb.append(causeException.toString()); return sb.toString(); } EJBException();  EJBException(Exception causeException);  EJBException(String message);  EJBException(String message, Exception causeException); Exception getCausedByException(); @Override Throwable getCause(); String getMessage(); void printStackTrace(PrintStream ps); void printStackTrace(PrintWriter pw); void printStackTrace();  }### Answer:
@Test public void testGetMessage() { Assert.assertEquals(null, exceptionDefaultConstructor.getMessage()); Assert.assertEquals(null, exceptionWithNullMessage.getMessage()); Assert.assertEquals("msg", exceptionWithMessage.getMessage()); Assert.assertEquals("msg; nested exception is: java.lang.Exception: cause", exceptionWithCausedBy.getMessage()); Assert.assertEquals("msg", exceptionWithInitCause.getMessage()); Assert.assertEquals("msg; nested exception is: java.lang.Exception: cause", exceptionWithCausedByAndInitCause.getMessage()); }