### Question:
CommentController { @GetMapping("/leaveMsg") public Response retrievePageOfLeaveMsg(@RequestParam(value = "count", required = false, defaultValue = "10") int count, @RequestParam(value = "page", required = false, defaultValue = "1") int page) { return ResponseUtil.success(commentService.retrievePageByTypeAndPid(false, -1, page, count)); }  @PostMapping("/user/comment/create") Response addOne(@RequestBody CommentReq reqBody); @DeleteMapping("/user/comment/del") Response delete(@RequestParam("id") long id); @PutMapping("/user/comment/update") Response update(@RequestBody CommentReq reqBody); @GetMapping("/comments") Response commentsOfArticle(@RequestParam("articleId") long articleId,
                                      @RequestParam(value = "count", required = false, defaultValue = "10") int count,
                                      @RequestParam(value = "page", required = false, defaultValue = "1") int page); @GetMapping("/comment/pid/{pid}") Response retrievePage(@PathVariable("pid") long pid,
                                 @RequestParam(value = "count", required = false, defaultValue = "10") int count,
                                 @RequestParam(value = "page", required = false, defaultValue = "1") int page); @GetMapping("/leaveMsg") Response retrievePageOfLeaveMsg(@RequestParam(value = "count", required = false, defaultValue = "10") int count,
                                           @RequestParam(value = "page", required = false, defaultValue = "1") int page); @GetMapping("/admin/comment/type/{type}") Response retrievePageAdmin(
            @PathVariable("type") int isComment,
            @RequestParam(value = "count", required = false, defaultValue = "10") int count,
            @RequestParam(value = "page", required = false, defaultValue = "1") int page); @GetMapping("/user/comment/type/{type}") Response retrievePageByAuthor(
            @PathVariable(value = "type") int isComment,
            @RequestParam(value = "count", required = false, defaultValue = "10") int count,
            @RequestParam(value = "page", required = false, defaultValue = "1") int page);  }### Answer:
@Test public void retrievePageOfLeaveMsg() throws Exception { mockMvc.perform(get("/leaveMsg?page=1&count=10")).andDo(result -> { JSONObject object = JSONObject.fromObject(result.getResponse().getContentAsString()); assertEquals(SUCCESS.getCode(), object.getInt(Code)); PageInfo pageInfo = (PageInfo) JSONObject.toBean(object.getJSONObject(Result), PageInfo.class); assertNotEquals(0, pageInfo.getStartRow()); assertNotEquals(0, pageInfo.getEndRow()); assertEquals(1, pageInfo.getPageNum()); assertEquals(10, pageInfo.getPageSize()); pageInfo.getList().forEach(o -> { CommentModel model = (CommentModel) JSONObject.toBean(JSONObject.fromObject(o), CommentModel.class); assertEquals(-1, model.getArticleID()); assertNotNull(model.getDate()); assertNotNull(model.getAuthorName()); assertNotNull(model.getAuthorAvatarImgUrl()); assertNotNull(model.getContent()); assertNotNull(model.getResponseId()); assertFalse(model.isComment()); }); }); }