StackTraceSimplifier { public static boolean isStackTraceElementUseful(StackTraceElement el) { return DEFAULT_INSTACE.isUseful(el); } protected  StackTraceSimplifier(); protected  StackTraceSimplifier(boolean includeDefaultBlacklist, String ...packages); static StackTraceSimplifier newInstance(); static StackTraceSimplifier newInstance(String ...additionalBlacklistPackagePrefixes); static StackTraceSimplifier newInstanceExcludingOnly(String ...blacklistPackagePrefixes); boolean isUseful(StackTraceElement el); List<StackTraceElement> clean(Iterable<StackTraceElement> st); StackTraceElement[] clean(StackTraceElement[] st); StackTraceElement firstUseful(StackTraceElement[] st); StackTraceElement nthUseful(int n, StackTraceElement[] st); T cleaned(T t); static boolean isStackTraceElementUseful(StackTraceElement el); static List<StackTraceElement> cleanStackTrace(Iterable<StackTraceElement> st); static StackTraceElement[] cleanStackTrace(StackTraceElement[] st); static T cleanedStackTrace(T t); static String toString(Throwable t); @Beta // useful to track down things like https://github.com/apache/incubator-brooklyn/pull/489 static int getRecursiveCallCount(); static final String DEFAULT_BLACKLIST_SYSTEM_PROPERTY_NAME; }
@Test public void isStackTraceElementUsefulRejectsABlacklistedPackage() { StackTraceElement el = new StackTraceElement("groovy.lang.Foo", "bar", "groovy/lang/Foo.groovy", 42); Assert.assertFalse(StackTraceSimplifier.isStackTraceElementUseful(el)); }
@Test public void isStackTraceElementUsefulAcceptsANonBlacklistedPackage() { StackTraceElement el = new StackTraceElement( "brooklyn.util.task", "StackTraceSimplifierTest", "StackTraceSimplifierTest.groovy", 42); Assert.assertTrue(StackTraceSimplifier.isStackTraceElementUseful(el)); }