ServletResponseResultWriter implements ResultWriter { @Override public void writeError(ServiceException e) throws IOException { Map<String, String> errors = new HashMap<>(); errors.put(Constant.ERROR_MESSAGE, e.getMessage()); write(e.getStatusCode(), e.getHeaders(), errors); } ServletResponseResultWriter(
      HttpServletResponse servletResponse, ApiSerializationConfig serializationConfig);  ServletResponseResultWriter(
      HttpServletResponse servletResponse, ApiSerializationConfig serializationConfig,
      boolean prettyPrint, boolean addContentLength); @Override void write(Object response); @Override void writeError(ServiceException e);  }
@Test public void testWriteErrorResponseHeaders() throws Exception { MockHttpServletResponse response = new MockHttpServletResponse(); ServletResponseResultWriter writer = new ServletResponseResultWriter(response, null); Map<String, String> headers = new LinkedHashMap<>(); headers.put("name0", "value0"); headers.put("name1", "value1"); writer.writeError(new UnauthorizedException("message", "schema", headers)); assertEquals("schema name0=value0, name1=value1", response.getHeader("WWW-Authenticate")); }