use of org.apache.axiom.util.stax.WrappedTextNodeStreamReader in project webservices-axiom by apache.
the class WrappedTextNodeStreamReaderTest method testUsingBuilder.
//
// Tests that construct the Axiom tree and check the result
//
private void testUsingBuilder(QName wrapperElementName, String testString, int chunkSize) {
StringReader reader = new StringReader(testString);
XMLStreamReader xmlStreamReader = new WrappedTextNodeStreamReader(wrapperElementName, reader, chunkSize);
OMElement element = OMXMLBuilderFactory.createStAXOMBuilder(xmlStreamReader).getDocumentElement();
assertEquals(wrapperElementName, element.getQName());
assertEquals(wrapperElementName.getPrefix(), element.getQName().getPrefix());
assertEquals(testString, element.getText());
}
use of org.apache.axiom.util.stax.WrappedTextNodeStreamReader in project webservices-axiom by apache.
the class WrappedTextNodeStreamReaderTest method testUsingSerializeAndConsume.
//
// Tests that construct the Axiom tree, serialize it using serializeAndConsume and
// compare with the expected result.
//
private void testUsingSerializeAndConsume(QName wrapperElementName, String testString, int chunkSize, String expectedXML) throws Exception {
StringReader reader = new StringReader(testString);
XMLStreamReader xmlStreamReader = new WrappedTextNodeStreamReader(wrapperElementName, reader, chunkSize);
OMElement element = OMXMLBuilderFactory.createStAXOMBuilder(xmlStreamReader).getDocumentElement();
StringWriter writer = new StringWriter();
element.serializeAndConsume(writer);
assertAbout(xml()).that(writer.toString()).hasSameContentAs(expectedXML);
}
Aggregations