22 Exception exception =
new Exception();
25 StringWriter stringWriter =
new StringWriter();
26 PrintWriter printWriter =
new PrintWriter(stringWriter);
27 exception.printStackTrace(printWriter);
28 String expectStr = stringWriter.toString();
30 assertEquals(str, expectStr);