Exceptions { public static String stackTrace(Throwable e) { var writer = new StringWriter(); e.printStackTrace(new PrintWriter(writer)); return writer.toString(); }  static String stackTrace(Throwable e);  }
@Test void stackTrace() { String trace = Exceptions.stackTrace(new Error("test-error")); assertThat(trace).contains("java.lang.Error: test-error"); }