XMLStreamWriter writer = new SimpleXMLStreamWriter(result, true);
writer.writeStartDocument();
writer.writeStartElement("http://some-namespace", "alice");
writer.writeCharacters("bob");
writer.writeEndElement();
writer.writeEndDocument();
writer.close();
Assert.assertEquals("<?xml version=\"1.0\" encoding=\"UTF-8\"?><alice xmlns=\"http://some-namespace\">bob</alice>", result.toString());
}
@Test(expected = XMLStreamException.class)