### Question:
XmlPayloadIO implements IPayloadIO<Document> { @Override public Document unmarshall(InputStream input) throws Exception { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(true); factory.setValidating(false); DocumentBuilder builder = factory.newDocumentBuilder(); Document doc = builder.parse(input); return doc; }  @Override Document unmarshall(InputStream input); @Override Document unmarshall(byte[] input); @Override byte[] marshall(Document data);  }### Answer:
@Test public void testUnmarshall_Simple() throws Exception { String xml = "<?xml version=\"1.0\"?>\r\n" + "<book xmlns=\"urn:ns1\">\r\n" + " <author>Gambardella, Matthew</author>\r\n" + " <title>XML Developer's Guide</title>\r\n" + " <genre>Computer</genre>\r\n" + " <price>44.95</price>\r\n" + " <publish_date>2000-10-01</publish_date>\r\n" + " <description>An in-depth look at creating applications with XML.</description>\r\n" + "</book>"; byte [] xmlBytes = xml.getBytes(); XmlPayloadIO io = new XmlPayloadIO(); try (InputStream is = new ByteArrayInputStream(xmlBytes)) { Document document = io.unmarshall(is); Assert.assertNotNull(document); Assert.assertEquals("book", document.getDocumentElement().getLocalName()); Assert.assertEquals("urn:ns1", document.getDocumentElement().getNamespaceURI()); } }