### Question:
DOMUtils { public static Document newDocument(InputStream inputStream) throws DocumentException { SAXReader saxReader = new SAXReader(); Document saxDoc = saxReader.read(inputStream); DOMWriter domWriter = new DOMWriter(); org.w3c.dom.Document domObject = domWriter.write(saxDoc); DOMReader domReader = new DOMReader(); return domReader.read(domObject); }  static Document newDocument(InputStream inputStream); static void write(Document document, OutputStream outputStream);  }### Answer:
@Test public void testNewDocument() throws DocumentException { String xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" + "<resources attr1=\"sdfklj\" attr2=\"sdf\">" + "<string name=\"app_name\">Pathfinder Toolkit Test</string>" + "</resources>"; Document document = DOMUtils.newDocument(new ByteArrayInputStream(xml.getBytes(Charsets.UTF_8))); assertThat(document.asXML().toLowerCase(), equalTo(xml.toLowerCase())); }