JsonHomeResource { @GET @Produces(MediaType.APPLICATION_JSON) public Response getAsApplicationJson() { final JsonHome jsonHome = jsonHomeSource.getJsonHome(); try { return addCacheControlHeaders(Response.ok(toJsonString(jsonHome, APPLICATION_JSON)), maxAge); } catch (IOException e) { return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); } } JsonHomeResource(JsonHomeSource jsonHomeSource);  JsonHomeResource(); void setJsonHomeSource(JsonHomeSource jsonHomeSource); void setMaxAge(int maxAge); @GET @Produces(MediaType.TEXT_HTML) Response getAsTextHtmlHome(); @GET @Produces("application/json-home") Response getAsApplicationJsonHome(); @GET @Produces(MediaType.APPLICATION_JSON) Response getAsApplicationJson();  }
@Test public void applicationJsonShouldContainAdditionalInformation() throws Exception { final JsonHomeResource controller = new JsonHomeResource( jsonHomeSource(ResourceFixtures.ResourceWithDocumentation.class)); final Response response = controller.getAsApplicationJson(); @SuppressWarnings("unchecked") final Map<String, ?> resourcesMap = new ObjectMapper().readValue((String) response.getEntity(), Map.class); @SuppressWarnings("unchecked") final Map<String, Map<String, ?>> resources = (Map<String, Map<String, ?>>) resourcesMap.get("resources"); final Map<String, ?> hints = asMap(resources.get("http: assertEquals(hints.get("description"), asList("resource value")); }