### Question:
VisitorController { @GetMapping("/ip/{ip}") public Response ipLocation(@PathVariable("ip") String ip) { return ResponseUtil.success(visitorService.location(ip)); }  @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 ipLocation() throws Exception { String ip = "127.0.0.1"; mockMvc.perform(get("/ip/" + ip)).andDo(MockMvcResultHandlers.print()).andDo(result -> { assertEquals(SUCCESS.getCode(), JSONObject.fromObject(result.getResponse().getContentAsString()).getInt(Code)); assertTrue(JSONObject.fromObject(result.getResponse().getContentAsString()).containsKey(Result)); }); }