Search in sources :

Example 1 with InstrumentedWriter

use of org.apache.axiom.testutils.io.InstrumentedWriter in project webservices-axiom by apache.

the class TestWriteTextTo method runTest.

@Override
protected void runTest() throws Throwable {
    OMFactory factory = metaFactory.getOMFactory();
    OMElement element = factory.createOMElement(new QName("a"));
    factory.createOMText(element, "test");
    StringWriter sw = new StringWriter();
    InstrumentedWriter out = new InstrumentedWriter(sw);
    element.writeTextTo(out, true);
    assertEquals(element.getText(), sw.toString());
    assertFalse(out.isClosed());
}
Also used : OMFactory(org.apache.axiom.om.OMFactory) StringWriter(java.io.StringWriter) QName(javax.xml.namespace.QName) InstrumentedWriter(org.apache.axiom.testutils.io.InstrumentedWriter) OMElement(org.apache.axiom.om.OMElement)

Aggregations

StringWriter (java.io.StringWriter)1 QName (javax.xml.namespace.QName)1 OMElement (org.apache.axiom.om.OMElement)1 OMFactory (org.apache.axiom.om.OMFactory)1 InstrumentedWriter (org.apache.axiom.testutils.io.InstrumentedWriter)1