@Test public void add() throws Exception { mockMvc.perform(post("/visit")).andDo(MockMvcResultHandlers.print()).andDo(result -> { JSONObject object = JSONObject.fromObject(result.getResponse().getContentAsString()); assertEquals(SUCCESS.getCode(), object.getInt(Code)); VisitorModel visitorModel = (VisitorModel) JSONObject.toBean(object.getJSONObject(Result), VisitorModel.class); assertNotEquals(0, visitorModel.getId()); assertNotNull(visitorModel.getIp()); }); }
@PostMapping("/visit") public Response add(HttpServletRequest request) { return ResponseUtil.success(visitorService.addVisitor(request)); }
VisitorController { @PostMapping("/visit") public Response add(HttpServletRequest request) { return ResponseUtil.success(visitorService.addVisitor(request)); } }
VisitorController { @PostMapping("/visit") public Response add(HttpServletRequest request) { return ResponseUtil.success(visitorService.addVisitor(request)); }  }
VisitorController { @PostMapping("/visit") public Response add(HttpServletRequest request) { return ResponseUtil.success(visitorService.addVisitor(request)); }  @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); }
VisitorController { @PostMapping("/visit") public Response add(HttpServletRequest request) { return ResponseUtil.success(visitorService.addVisitor(request)); }  @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);  }