Utils { public static String formatExceptionForToolsWithLimitedCharacterSet(String exceptionLabel) { if (exceptionLabel == null) { return null; } return exceptionLabel. replace(",ErrorCode=", ".ErrorCode "). replace(",SQLState=", "-SQLState "); }  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 testFormatExceptionForToolsWithLimitedCharacterSet() { assertThat(Utils.formatExceptionForToolsWithLimitedCharacterSet(null)).describedAs("Null values should return unchanged").isNull(); String before = "java.sql.SQLException,ErrorCode=400,SQLState=Login failure"; String after = "java.sql.SQLException.ErrorCode 400-SQLState Login failure"; assertThat(Utils.formatExceptionForToolsWithLimitedCharacterSet(before)).describedAs("StatsD string is not as expected (remove ,=)").isEqualTo(after); String plainException = "java.lang.Exception"; assertThat(Utils.formatExceptionForToolsWithLimitedCharacterSet(plainException)).describedAs("Nonsql exceptions should have no change").isEqualTo(plainException); }