public void testJAXBWrite() throws Exception {
Service s = new JAXRSServiceImpl(Collections.singletonList(c), true);
DataBinding binding = new JAXBDataBinding();
binding.initialize(s);
DataBindingProvider<Book> p = new DataBindingProvider<Book>(binding);
Book b = new Book("CXF", 127L);
ByteArrayOutputStream bos = new ByteArrayOutputStream();
p.writeTo(b, Book.class, Book.class,
new Annotation[0], MediaType.TEXT_XML_TYPE, new MetadataMap<String, Object>(), bos);
String data = "<Book><id>127</id><name>CXF</name><state></state></Book>";
assertEquals(bos.toString(), data);