### Question:
CategoryController { @PostMapping("/admin/category/create") public Response addOne(@RequestParam("name") String name) { return ResponseUtil.success(categoryService.create(name)); }  @PostMapping("/admin/category/create") Response addOne(@RequestParam("name") String name); @DeleteMapping("/admin/category/del") Response deleteOne(@RequestParam("id") long id); @PutMapping("/admin/category/update") Response updateOne(@RequestParam("id") Long id,
                              @RequestParam("name") String name); @GetMapping("/categories") Response getPage();  }### Answer:
@Test public void addOne() throws Exception { String categoryName = UUID.randomUUID().toString().substring(0, 4); System.out.println("categoryName: ==> " + categoryName); mockMvc.perform(post("/admin/category/create?name=" + categoryName)).andExpect(status().isOk()) .andDo(result -> { assertEquals(HAVE_NOT_LOG_IN.getCode(), JSONObject.fromObject(result.getResponse().getContentAsString()).getInt(Code)); }); String token = userLogin(); mockMvc.perform(post("/admin/category/create?name=" + categoryName) .header("Authorization", token)) .andExpect(status().isOk()) .andDo(result -> { assertEquals(PERMISSION_ERROR.getCode(), JSONObject.fromObject(result.getResponse().getContentAsString()).getInt(Code)); }); token = adminLogin(); mockMvc.perform(post("/admin/category/create?name=" + categoryName) .header("Authorization", token)) .andExpect(status().isOk()) .andDo(result -> { JSONObject object = JSONObject.fromObject(result.getResponse().getContentAsString()); assertEquals(SUCCESS.getCode(), object.getInt(Code)); Category category = (Category) JSONObject.toBean(object.getJSONObject(Result), Category.class); assertEquals(categoryName, category.getName()); assertNotNull(category.getId()); assertNotNull(category.getArticles()); }); }