CommentsController extends BaseController { @RequestMapping(value = {""}, method = RequestMethod.POST) public @ResponseBody ResponseEntity post(@RequestBody Comment comments) { commentsService.postComments(comments); return success(); }  @RequestMapping(value = {""}, method = RequestMethod.POST) @ResponseBody ResponseEntity post(@RequestBody Comment comments); @RequestMapping(value = {""}, method = RequestMethod.GET) @ResponseBody PageOut<CommentsOut> get(int page, Integer articleId);  }
@Test public void testPost() throws Exception { Comment comment = new Comment(); comment.setEmail("das"); comment.setUserName("chul"); comment.setArticleId(1); comment.setUri("sdasd"); comment.setComment("sdas"); String json = JsonUtil.toJsonString(comment); mockMvc.perform(post("/api/comments").cookie(new Cookie(NetUtil.SESSION_ID, "abc")).contentType(MediaType.APPLICATION_JSON).content(json).param("asd", "asds")).andExpect(status().isOk()); }