### Question:
XMLResourceExceptionHandler implements ResponseWriter { public static Document asXMLDOM(Map<String, Object> map) { try { Document document = XMLUtils.newDocument(); Element root = write(document, "error", map); document.appendChild(root); return document; } catch (ParserConfigurationException e1) { throw new IllegalStateException("Cannot construct DOM Document", e1); } }  Collection<MediaType> handles(); @Override void write(MessageContext context, AuthenticationException exception); static Document asXMLDOM(Map<String, Object> map);  }### Answer:
@Test public void testAsXMLDOM() throws Exception { ResourceException ex = new NotFoundException("I don't know where it is"); AbstractMap.SimpleEntry<String, Integer> entry = new AbstractMap.SimpleEntry<String, Integer>("a", 1); ex.setDetail(new JsonValue(JsonValue.array(new JsonValue(JsonValue.object(entry))))); String text = XMLUtils.print(handler.asXMLDOM(ex.toJsonValue().asMap()).getDocumentElement()); assertThat(text).contains("<message>I don't know where it is</message>"); assertThat(text).contains("<code>404</code>"); assertThat(text).contains("<detail><entry><a>1</a></entry></detail>"); }