@Test public void testSingleLineExceptionTrace() { String res = ErrorUtil.singleLineExceptionTrace(DUMMY_EXCEPTION); assertTrue(res.startsWith("java.lang.RuntimeException: dummy msg (at " + thisClass() + ".<clinit>(" + this.getClass().getSimpleName())); }
public static String singleLineExceptionTrace(Exception e) { String m = e.toString(); String stackTraceString = stackTraceString(e); String[] stackTraceLines = stackTraceString.split("\n"); String lastMethod = stackTraceLines.length == 0 ? "" : stackTraceLines[1].replace("\t", ""); return String.format("%s (%s)", m, lastMethod); }
ErrorUtil { public static String singleLineExceptionTrace(Exception e) { String m = e.toString(); String stackTraceString = stackTraceString(e); String[] stackTraceLines = stackTraceString.split("\n"); String lastMethod = stackTraceLines.length == 0 ? "" : stackTraceLines[1].replace("\t", ""); return String.format("%s (%s)", m, lastMethod); } }
ErrorUtil { public static String singleLineExceptionTrace(Exception e) { String m = e.toString(); String stackTraceString = stackTraceString(e); String[] stackTraceLines = stackTraceString.split("\n"); String lastMethod = stackTraceLines.length == 0 ? "" : stackTraceLines[1].replace("\t", ""); return String.format("%s (%s)", m, lastMethod); }  }
ErrorUtil { public static String singleLineExceptionTrace(Exception e) { String m = e.toString(); String stackTraceString = stackTraceString(e); String[] stackTraceLines = stackTraceString.split("\n"); String lastMethod = stackTraceLines.length == 0 ? "" : stackTraceLines[1].replace("\t", ""); return String.format("%s (%s)", m, lastMethod); }  static String fullExceptionDetails(Exception e); static String singleLineExceptionTrace(Exception e); static String stackTraceString(Exception e); }
ErrorUtil { public static String singleLineExceptionTrace(Exception e) { String m = e.toString(); String stackTraceString = stackTraceString(e); String[] stackTraceLines = stackTraceString.split("\n"); String lastMethod = stackTraceLines.length == 0 ? "" : stackTraceLines[1].replace("\t", ""); return String.format("%s (%s)", m, lastMethod); }  static String fullExceptionDetails(Exception e); static String singleLineExceptionTrace(Exception e); static String stackTraceString(Exception e);  }