### Question:
LinksController { @PostMapping("/admin/links/create") public Response create(@RequestBody LinkReq reqBody) { return ResponseUtil.success(partnerSiteService.create(reqBody)); }  @PostMapping("/admin/links/create") Response create(@RequestBody LinkReq reqBody); @DeleteMapping("/admin/links/del/{id}") Response del(@PathVariable("id") long id); @PutMapping("/admin/links/update") Response update(@RequestBody LinkReq reqBody); @GetMapping("/links") Response allForOpen(); @GetMapping("/admin/links") Response all(@RequestParam("page") int page,
                        @RequestParam("count") int count); @PostMapping("/apply") Response apply(@RequestParam("name") String name,
                          @RequestParam("url") String url);  }### Answer:
@Test public void create() throws Exception { LinkReq linkReq = new LinkReq(); linkReq.setName(UUID.randomUUID().toString().substring(0, 4)); linkReq.setOpen(false); linkReq.setUrl("https: String token = adminLogin(); mockMvc.perform( post("/admin/links/create") .content(JSONObject.fromObject(linkReq).toString()) .header("Authorization", token) .contentType(MediaType.APPLICATION_JSON) ).andDo(result -> { JSONObject object = JSONObject.fromObject(result.getResponse().getContentAsString()); assertEquals(SUCCESS.getCode(), object.getInt(Code)); PartnerSite site = (PartnerSite) JSONObject.toBean(object.getJSONObject(Result), PartnerSite.class); assertNotNull(site.getId()); assertEquals(linkReq.getName(), site.getName()); assertEquals(linkReq.getUrl(), site.getUrl()); assertEquals(linkReq.isOpen(), site.getOpen()); }); linkReq.setName(UUID.randomUUID().toString().substring(0, 4)); linkReq.setOpen(false); linkReq.setUrl("example.com"); mockMvc.perform( post("/admin/links/create") .content(JSONObject.fromObject(linkReq).toString()) .header("Authorization", token) .contentType("application/json") ).andDo(result -> { JSONObject object = JSONObject.fromObject(result.getResponse().getContentAsString()); assertEquals(SUCCESS.getCode(), object.getInt(Code)); PartnerSite site = (PartnerSite) JSONObject.toBean(object.getJSONObject(Result), PartnerSite.class); assertEquals("http: }); mockMvc.perform( post("/admin/links/create") .content(JSONObject.fromObject(linkReq).toString()) .header("Authorization", token) .contentType("application/json") ).andDo(result -> assertEquals(DATA_HAS_EXIST.getCode(), JSONObject.fromObject(result.getResponse().getContentAsString()).getInt(Code))); }