@Test public void explainThrowable3() { String msg = Throwables2.explain( new RuntimeException("foo", new Exception( new Exception("bar") ) ) ); log(msg); assertThat(msg, is("java.lang.RuntimeException: foo, caused by: java.lang.Exception, caused by: java.lang.Exception: bar")); }
public static String explain(final Throwable throwable) { checkNotNull(throwable); StringBuilder buff = new StringBuilder(); explain(buff, throwable); Throwable cause = throwable; while ((cause = cause.getCause()) != null) { buff.append(", caused by: "); explain(buff, cause); } return buff.toString(); }
Throwables2 { public static String explain(final Throwable throwable) { checkNotNull(throwable); StringBuilder buff = new StringBuilder(); explain(buff, throwable); Throwable cause = throwable; while ((cause = cause.getCause()) != null) { buff.append(", caused by: "); explain(buff, cause); } return buff.toString(); } }
Throwables2 { public static String explain(final Throwable throwable) { checkNotNull(throwable); StringBuilder buff = new StringBuilder(); explain(buff, throwable); Throwable cause = throwable; while ((cause = cause.getCause()) != null) { buff.append(", caused by: "); explain(buff, cause); } return buff.toString(); }  }
Throwables2 { public static String explain(final Throwable throwable) { checkNotNull(throwable); StringBuilder buff = new StringBuilder(); explain(buff, throwable); Throwable cause = throwable; while ((cause = cause.getCause()) != null) { buff.append(", caused by: "); explain(buff, cause); } return buff.toString(); }  static String explain(final Throwable throwable); static T composite(final T root, final Throwable... suppressed); static T composite(final T root, final Collection<? extends Throwable> suppressed); }
Throwables2 { public static String explain(final Throwable throwable) { checkNotNull(throwable); StringBuilder buff = new StringBuilder(); explain(buff, throwable); Throwable cause = throwable; while ((cause = cause.getCause()) != null) { buff.append(", caused by: "); explain(buff, cause); } return buff.toString(); }  static String explain(final Throwable throwable); static T composite(final T root, final Throwable... suppressed); static T composite(final T root, final Collection<? extends Throwable> suppressed);  }