}
@Test
public void testMap() throws Exception
{
JAXBContext ctx = JAXBContext.newInstance(JaxbMap.class, JaxbMap.Entry.class, Foo.class);
JaxbMap map = new JaxbMap("entry", "key", "http://jboss.org/resteasy");
map.addEntry("bill", new Foo("hello"));
JAXBElement<JaxbMap> element = new JAXBElement<JaxbMap>(new QName("http://jboss.org/resteasy", "map", "resteasy"), JaxbMap.class, map);
StringWriter writer = new StringWriter();
ctx.createMarshaller().marshal(element, writer);
String s = writer.toString();
System.out.println(s);
ByteArrayInputStream is = new ByteArrayInputStream(s.getBytes());
StreamSource source = new StreamSource(is);
JAXBContext ctx2 = JAXBContext.newInstance(JaxbMap.class);
element = ctx2.createUnmarshaller().unmarshal(source, JaxbMap.class);
Element entry = (Element) element.getValue().getValue().get(0);
JAXBContext ctx3 = JAXBContext.newInstance(JaxbMap.Entry.class);
JAXBElement<JaxbMap.Entry> e = ctx3.createUnmarshaller().unmarshal(entry, JaxbMap.Entry.class);
System.out.println("hello");
}