@Test public void testWriteError() throws Exception { ByteArrayOutputStream out = new ByteArrayOutputStream(); Exception error = new MonetaException("Outer exception message", new IllegalArgumentException("Inner exception message")) .addContextValue("context", "contextValue"); ServletUtils.writeError(427, error, out); Assert.assertTrue(out.toString().contains("Outer exception message")); Assert.assertTrue(out.toString().contains("Inner exception message")); Assert.assertTrue(out.toString().contains("contextValue")); }
public static void writeError(Integer errorCode, Exception error, OutputStream out) { SearchResult result = new SearchResult(); result.setErrorCode(errorCode); result.setErrorMessage(ExceptionUtils.getStackTrace(error)); writeResult(result, out); }
ServletUtils { public static void writeError(Integer errorCode, Exception error, OutputStream out) { SearchResult result = new SearchResult(); result.setErrorCode(errorCode); result.setErrorMessage(ExceptionUtils.getStackTrace(error)); writeResult(result, out); } }
ServletUtils { public static void writeError(Integer errorCode, Exception error, OutputStream out) { SearchResult result = new SearchResult(); result.setErrorCode(errorCode); result.setErrorMessage(ExceptionUtils.getStackTrace(error)); writeResult(result, out); }  }
ServletUtils { public static void writeError(Integer errorCode, Exception error, OutputStream out) { SearchResult result = new SearchResult(); result.setErrorCode(errorCode); result.setErrorMessage(ExceptionUtils.getStackTrace(error)); writeResult(result, out); }  static void writeResult(SearchResult result, OutputStream out); static void writeError(Integer errorCode, Exception error, OutputStream out); }
ServletUtils { public static void writeError(Integer errorCode, Exception error, OutputStream out) { SearchResult result = new SearchResult(); result.setErrorCode(errorCode); result.setErrorMessage(ExceptionUtils.getStackTrace(error)); writeResult(result, out); }  static void writeResult(SearchResult result, OutputStream out); static void writeError(Integer errorCode, Exception error, OutputStream out);  }