public static String getTrimmedStackTrace ( Throwable exception ) { List < String > trimmedStackTraceLines = getTrimmedStackTraceLines ( exception ) ; if ( trimmedStackTraceLines . isEmpty ( ) ) { return getFullStackTrace ( exception ) ; } StringBuilder result = new StringBuilder ( exception . toString ( ) ) ; appendStackTraceLines ( trimmedStackTraceLines , result ) ; appendStackTraceLines ( getCauseStackTraceLines ( exception ) , result ) ; return result . toString ( ) ; }
Gets a trimmed version of the stack trace of the given exception . Stack trace elements that are below the test method are filtered out .