@Test
public void writesSAXSourceToOutputStream() throws Exception {

    ByteArrayOutputStream out = new ByteArrayOutputStream();
    saxSourceEntityProvider.writeTo(new SAXSource(new InputSource(new ByteArrayInputStream(TEST_XML_CONTENT_BYTES))), SAXSource.class, null, null, APPLICATION_XML_TYPE, null, out);
    Document serializedDocument = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new ByteArrayInputStream(out.toByteArray()));
    assertThatXmlDocumentContainsAllExpectedNodes(serializedDocument);
}