assertEquals("Hello", reader.getText());
}
@Test
public void testWriteWithContextualNamespaceDecls() throws Exception {
JAXBDataBinding db = getTestWriterFactory(GreetMe.class);
Map<String, String> nspref = new HashMap<String, String>();
nspref.put("http://apache.org/hello_world_soap_http/types", "x");
db.setNamespaceMap(nspref);
db.setContextualNamespaceMap(nspref);
// use the output stream instead of XMLStreamWriter to test
DataWriter<OutputStream> dw = db.createWriter(OutputStream.class);
assertNotNull(dw);
GreetMe val = new GreetMe();
val.setRequestType("Hello");
dw.write(val, baos);
String xstr = new String(baos.toByteArray());
// there should be no namespace decls
if (!db.getContext().getClass().getName().contains("eclipse")) {
//bug in eclipse moxy
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=421463
assertEquals("<x:greetMe><x:requestType>Hello</x:requestType></x:greetMe>", xstr);
}