}
public void testJAXBElementProviderReaderWriter() throws SecurityException,
NoSuchFieldException {
JAXBElementXmlProvider provider = new JAXBElementXmlProvider();
AtomFeed af = new AtomFeed();
org.apache.wink.common.model.atom.ObjectFactory objectFactory =
new org.apache.wink.common.model.atom.ObjectFactory();
JAXBElement<AtomFeed> feed = objectFactory.createFeed(af);
Type genericType =
JAXBElementProviderTest.class.getDeclaredField("atomfeed").getGenericType();
assertTrue(provider.isWriteable(feed.getClass(), genericType, null, new MediaType("text",
"xml")));
assertTrue(provider.isWriteable(feed.getClass(),
genericType,
null,
new MediaType("application", "xml")));
assertTrue(provider.isWriteable(feed.getClass(),
genericType,
null,
new MediaType("application", "atom+xml")));
assertTrue(provider.isWriteable(feed.getClass(),
genericType,
null,
new MediaType("application", "atomsvc+xml")));
assertFalse(provider
.isWriteable(feed.getClass(), genericType, null, new MediaType("text", "plain")));
assertTrue(provider.isReadable(feed.getClass(), genericType, null, new MediaType("text",
"xml")));
assertTrue(provider.isReadable(feed.getClass(),
genericType,
null,
new MediaType("application", "xml")));
assertTrue(provider.isReadable(feed.getClass(),
genericType,
null,
new MediaType("application", "atom+xml")));
assertTrue(provider.isReadable(feed.getClass(),
genericType,
null,
new MediaType("application", "atomsvc+xml")));
assertFalse(provider.isReadable(feed.getClass(), genericType, null, new MediaType("text",
"plain")));
}