//@see WSS-437
@Test
public void testNamespaces() throws Exception {
StringWriter stringWriter = new StringWriter();
XMLStreamWriter xmlStreamWriter = XMLSecurityConstants.xmlOutputFactory.createXMLStreamWriter(stringWriter);
XMLEventWriter xmlEventWriter = new XMLSecurityEventWriter(xmlStreamWriter);
xmlEventWriter.add(new XMLSecStartElementImpl(new QName("http://ns1", "a", "ns1"), null, null));
xmlEventWriter.add(XMLSecNamespaceImpl.getInstance("ns1", "http://ns1"));
xmlEventWriter.add(new XMLSecStartElementImpl(new QName("http://ns2", "b", ""), null, null));
xmlEventWriter.add(XMLSecNamespaceImpl.getInstance("", "http://ns2"));
xmlEventWriter.add(new XMLSecEndElementImpl(new QName("http://ns2", "b", ""), null));
xmlEventWriter.add(new XMLSecStartElementImpl(new QName("http://ns3", "c", ""), null, null));
xmlEventWriter.close();
Assert.assertEquals(
"<ns1:a xmlns:ns1=\"http://ns1\">" +
"<b xmlns=\"http://ns2\"/>" +
"<c xmlns=\"http://ns3\">" +