Utils { public static String getLabel(Throwable throwable) { String sqlMessage = ""; if (throwable instanceof SQLException) { SQLException sqlException = (SQLException) throwable; sqlMessage = ",ErrorCode=" + sqlException.getErrorCode() + ",SQLState=" + sqlException.getSQLState(); } return throwable.getClass().getName() + sqlMessage; }  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 testBasicThrowableLabel() throws Exception { RuntimeException runtimeException = new RuntimeException("My RTE exception"); assertThat(Utils.getLabel(runtimeException)).isEqualTo("java.lang.RuntimeException"); }
@Test public void testSqlThrowableLabel() throws Exception { SQLException sqlException = new SQLException("My SQL exception", "Login failure", 400); assertThat(Utils.getLabel(sqlException)).isEqualTo("java.sql.SQLException,ErrorCode=400,SQLState=Login failure"); }