Utils { public static String getExceptionTrace(Throwable exception) { if (exception == null) { return UNKNOWN; } StackTraceElement elements[] = exception.getStackTrace(); StringBuilder sb = new StringBuilder().append(exception).append(LINE_SEPARATOR); for (int i = 0; i < elements.length; i++) { sb.append(elements[i]).append(LINE_SEPARATOR); } return sb.toString(); }  static Map<Throwable, AutomonExpirable> createExceptionMap(); static String getLabel(Throwable throwable); static String getLabel(JoinPoint.StaticPart jp); static String formatExceptionForToolsWithLimitedCharacterSet(String exceptionLabel); static List<String> getArgNameValuePairs(JoinPoint jp); static String argNameValuePairsToString(List<String> args); static String toStringWithLimit(Object parameter); static String getExceptionTrace(Throwable exception); static String[] tokenize(String string, String splitOn); static String stripFileScheme(String fileName); static AutomonMXBean getAutomonMxBean(Object aspect); static void registerWithJmx(Object aspect, AutomonMXBean mxBean); static void unregisterWithJmx(Object aspect); static boolean hasPackageName(String className); static T createFirst(String... classNames); static void removeClassNames(List<String> list); static final String LINE_SEPARATOR; }
@Test public void testGetExceptionTrace() throws Exception { assertThat(Utils.getExceptionTrace(null)).isEqualTo(Utils.UNKNOWN); RuntimeException e = new RuntimeException("my exception"); assertThat(Utils.getExceptionTrace(e)).contains("java.lang.RuntimeException: my exception"); assertThat(Utils.getExceptionTrace(e)).contains(getClass().getName()); }