### Question:
VisitorController { @GetMapping("/admin/visitor/page") public Response page(@RequestParam(value = "count", required = false, defaultValue = "10") int count, @RequestParam(value = "page", required = false, defaultValue = "1") int page, @RequestParam(value = "showLocation", required = false, defaultValue = "false") boolean showLocation) { return ResponseUtil.success(visitorService.visitorPage(page, count, showLocation)); }  @GetMapping("/visitor/count") Response getVisitorCount(); @GetMapping("/admin/visitor/page") Response page(@RequestParam(value = "count", required = false, defaultValue = "10") int count,
                         @RequestParam(value = "page", required = false, defaultValue = "1") int page,
                         @RequestParam(value = "showLocation", required = false, defaultValue = "false") boolean showLocation); @PostMapping("/visit") Response add(HttpServletRequest request); @GetMapping("/dayVisitCount") Response dayVisitCount(); @GetMapping("/ip/{ip}") Response ipLocation(@PathVariable("ip") String ip); @GetMapping("/ip") Response getIp(HttpServletRequest request);  }### Answer:
@Test public void page() throws Exception { int count = 10; int page = 1; mockMvc.perform(get("/admin/visitor/page?count=" + count + "&page=" + page).header("Authorization", adminLogin())) .andDo(result -> { JSONObject object = JSONObject.fromObject(result.getResponse().getContentAsString()); assertEquals(SUCCESS.getCode(), object.getInt(Code)); JSONObject resultJson = JSONObject.fromObject(object.getJSONObject(Result)); PageInfo pageInfo = (PageInfo) JSONObject.toBean(resultJson, PageInfo.class); assertNotEquals(0, pageInfo.getTotal()); assertNotEquals(0, pageInfo.getStartRow()); assertNotEquals(0, pageInfo.getEndRow()); assertEquals(1, pageInfo.getPageNum()); assertEquals(10, pageInfo.getPageSize()); for (Object ver : pageInfo.getList()) { VisitorModel v = (VisitorModel) JSONObject.toBean(JSONObject.fromObject(ver), VisitorModel.class); assertNotEquals(0, v.getId()); assertNotNull(v.getDate()); } }); }