@Test public void testResourceAsXml() throws Exception { final String text = item1resource().request("application/xml").get(String.class); System.out.println("Item XML is: " + text); final Book response = item1resource().request("application/xml").get(Book.class); assertNotNull("Should have returned an item!", response); assertEquals("item title", "Svejk", response.getTitle()); }
public String getTitle() { return title; }
Item { public String getTitle() { return title; } }
Item { public String getTitle() { return title; } Item();  Item(final String title, final String author); }
Item { public String getTitle() { return title; } Item();  Item(final String title, final String author); String getTitle(); String getAuthor(); @GET @Produces({MediaType.APPLICATION_XML, MediaType.TEXT_XML, MediaType.APPLICATION_JSON}) Item getXml(); @Override String toString(); }
Item { public String getTitle() { return title; } Item();  Item(final String title, final String author); String getTitle(); String getAuthor(); @GET @Produces({MediaType.APPLICATION_XML, MediaType.TEXT_XML, MediaType.APPLICATION_JSON}) Item getXml(); @Override String toString();  }