assertSame(String.class, classes[1]);
assertTrue(cdEx.getMessage().indexOf(getClass().getName()) >= 0);
}
public void testPrintStackTrace() throws IOException {
PicoException nestedException = new PicoException("Outer", new Exception("Inner")) {
};
PicoException simpleException = new PicoException("Outer") {
};
ByteArrayOutputStream out = new ByteArrayOutputStream();
PrintStream printStream = new PrintStream(out);
nestedException.printStackTrace(printStream);
simpleException.printStackTrace(printStream);
out.close();
assertTrue(out.toString().indexOf("Caused by:") > 0);
out = new ByteArrayOutputStream();
PrintWriter writer = new PrintWriter(out);
nestedException.printStackTrace(writer);
simpleException.printStackTrace(writer);
writer.flush();
out.close();
assertTrue(out.toString().indexOf("Caused by:") > 0);
}