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();  }
@Test public void testResourceAsXml() throws Exception { String text = item1resource().accept("application/xml").get(String.class); System.out.println("Item XML is: " + text); Book response = item1resource().accept("application/xml").get(Book.class); assertNotNull("Should have returned an item!", response); assertEquals("item title", "Svejk", response.getTitle()); }