private void computeStackTraceInformation ( StackTraceFilter stackTraceFilter , Throwable stackTraceHolder , boolean isInline ) { StackTraceElement filtered = stackTraceFilter . filterFirst ( stackTraceHolder , isInline ) ; // there are corner cases where exception can have a null or empty stack trace // for example, a custom exception can override getStackTrace() method if ( filtered == null ) { this . stackTraceLine = "-> at <<unknown line>>" ; this . sourceFile = "<unknown source file>" ; } else { this . stackTraceLine = "-> at " + filtered . toString ( ) ; this . sourceFile = filtered . getFileName ( ) ; } }
Eagerly compute the stacktrace line from the stackTraceHolder . Storing the Throwable is memory - intensive for tests that have large stacktraces and have a lot of invocations on mocks .