Bookstore { public String getName() { return name; } Bookstore(); @Path("items/{itemid}/") Item getItem(@PathParam("itemid") String itemid); @GET @Produces({MediaType.APPLICATION_XML, MediaType.TEXT_XML, MediaType.APPLICATION_JSON}) Bookstore getXml(); long getSystemTime(); Map<String, Item> getItems(); String getName(); void setName(String name);  }
@Test public void testResourceAsXml() throws Exception { WebResource webResource = resource(); Bookstore response = webResource.accept("application/xml").get(Bookstore.class); assertNotNull("Should have returned a bookstore!", response); assertEquals("bookstore name", "Czech Bookstore", response.getName()); }