File tree Expand file tree Collapse file tree
src/test/java/org/apache/commons/io Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2222import static org .junit .jupiter .api .Assertions .assertTrue ;
2323
2424import java .io .EOFException ;
25+ import java .io .PrintWriter ;
26+ import java .io .StringWriter ;
2527import java .util .Collections ;
2628import java .util .List ;
2729
@@ -56,6 +58,11 @@ public void testPrintStackTrace() {
5658 final EOFException cause = new EOFException ();
5759 final List <EOFException > list = Collections .singletonList (cause );
5860 final IOExceptionList sqlExceptionList = new IOExceptionList (list );
59- sqlExceptionList .printStackTrace ();
61+ StringWriter sw = new StringWriter ();
62+ PrintWriter pw = new PrintWriter (sw );
63+ sqlExceptionList .printStackTrace (pw );
64+ String st = sw .toString ();
65+ assertTrue (st .startsWith ("org.apache.commons.io.IOExceptionList: 1 exceptions: [java.io.EOFException]" ));
66+ assertTrue (st .contains ("Caused by: java.io.EOFException" ));
6067 }
6168}
You can’t perform that action at this time.
0 commit comments