CommentResource { @GET @Path("/{id}") public Comment commentById(@PathParam("id") Long id){ return commentDao.getCommentById(id); } CommentResource(CommentDAO commentDao); @GET @Path("/{id}") Comment commentById(@PathParam("id") Long id); @POST Comment createComment(@Auth AccessToken token, @Valid Comment comment); @POST @Path("/update") Response updateComment(@Auth AccessToken token, @Valid Comment comment); @POST @Path("/{id}/delete") Response deleteComment(@Auth AccessToken token, @PathParam("id") Long id);  }
@Test public void testCommentById() throws Exception { Response res = rule.getJerseyTest() .target("/comment/1") .request(MediaType.APPLICATION_JSON_TYPE) .get(); @SuppressWarnings("rawtypes") LinkedHashMap read = mapper.readValue(res.readEntity(String.class), LinkedHashMap.class); assertThat(res.getStatusInfo().getStatusCode()).isEqualTo(200); assertThat(read.get("content")).isEqualTo(comment.getContent()); }