Code example for CharArrayWriter

Methods: toString

0
 
	@Test 
	public void testPrintStackTracePrintWriter() { 
		Exception c = new RuntimeException("cause");
		JDOMException e = new JDOMException("foo", c);
		CharArrayWriter caw = new CharArrayWriter();
		e.printStackTrace(new PrintWriter(caw));
		String msg = caw.toString();
		assertTrue(msg != null);
		assertTrue(msg.indexOf(JDOMException.class.getName()) == 0);
		assertTrue(msg.indexOf("Caused by") > 0);
	} 
 
 
}