@Test public void writing_errors_includes_the_inner_exceptions() throws IOException { String nullPointerMessage = "null pointer message"; String objectCreationMessage = "creation message"; NullPointerException nullPointerException = new NullPointerException(nullPointerMessage); Exception exception = new ObjectCreationException(objectCreationMessage, nullPointerException); this.strategy.writeError(this.appendable, exception); String errorMessage = this.appendable.toString(); assertTrue(errorMessage.contains(nullPointerMessage)); assertTrue(errorMessage.contains(objectCreationMessage)); }
@Override public void writeError(Appendable appendable, Exception exception) throws IOException { appendable.append(StringUtil.repeat("\t", depth)); appendable.append("Exception thrown:"); appendable.append("\n"); appendable.append(expandedExceptionMessage(exception, new StringBuilder())); appendable.append("\n"); }
DebugTracingStrategy implements TracingStrategy { @Override public void writeError(Appendable appendable, Exception exception) throws IOException { appendable.append(StringUtil.repeat("\t", depth)); appendable.append("Exception thrown:"); appendable.append("\n"); appendable.append(expandedExceptionMessage(exception, new StringBuilder())); appendable.append("\n"); } }
DebugTracingStrategy implements TracingStrategy { @Override public void writeError(Appendable appendable, Exception exception) throws IOException { appendable.append(StringUtil.repeat("\t", depth)); appendable.append("Exception thrown:"); appendable.append("\n"); appendable.append(expandedExceptionMessage(exception, new StringBuilder())); appendable.append("\n"); }  }
DebugTracingStrategy implements TracingStrategy { @Override public void writeError(Appendable appendable, Exception exception) throws IOException { appendable.append(StringUtil.repeat("\t", depth)); appendable.append("Exception thrown:"); appendable.append("\n"); appendable.append(expandedExceptionMessage(exception, new StringBuilder())); appendable.append("\n"); }  void writeRequest(Appendable appendable, Object request); void writeCreated(Appendable appendable, Object request, Object specimen); @Override void writeError(Appendable appendable, Exception exception); }
DebugTracingStrategy implements TracingStrategy { @Override public void writeError(Appendable appendable, Exception exception) throws IOException { appendable.append(StringUtil.repeat("\t", depth)); appendable.append("Exception thrown:"); appendable.append("\n"); appendable.append(expandedExceptionMessage(exception, new StringBuilder())); appendable.append("\n"); }  void writeRequest(Appendable appendable, Object request); void writeCreated(Appendable appendable, Object request, Object specimen); @Override void writeError(Appendable appendable, Exception exception);  }