Class StackTraceFilter
java.lang.Object
org.mockito.internal.exceptions.stacktrace.StackTraceFilter
- All Implemented Interfaces:
Serializable
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfilter(StackTraceElement[] target, boolean keepTop) Example how the filter works (+/- means good/bad): [a+, b+, c-, d+, e+, f-, g+] -> [a+, b+, d+, e+, g+] Basically removes all bad from the middle.filterFirst(Throwable target, boolean isInline) This filtering strategy makes use of a fast-path computation to retrieve stackTraceElements from a Stacktrace of a Throwable.findSourceFile(StackTraceElement[] target, String defaultValue) Finds the source file of the target stack trace.
-
Constructor Details
-
StackTraceFilter
public StackTraceFilter()
-
-
Method Details
-
filter
Example how the filter works (+/- means good/bad): [a+, b+, c-, d+, e+, f-, g+] -> [a+, b+, d+, e+, g+] Basically removes all bad from the middle.If any good are in the middle of bad those are also removed. -
filterFirst
This filtering strategy makes use of a fast-path computation to retrieve stackTraceElements from a Stacktrace of a Throwable. It does so, by taking advantage of and .The provides a method to obtain an instance of an . The latter class has a method to fast-path into
Throwable.getStackTrace()and retrieve a singleStackTraceElement. This prevents the JVM from having to generate a full stacktrace, which could potentially be expensive if stacktraces become very large.- Parameters:
target- The throwable target to find the firstStackTraceElementthat should not be filtered out perCLEANER.- Returns:
- The first
StackTraceElementoutside of theCLEANER
-
findSourceFile
Finds the source file of the target stack trace. Returns the default value if source file cannot be found.
-