ProjectController { @RequestMapping(value = "/delete", method = RequestMethod.DELETE) public ServiceResult<String> delete(@Validated(DeleteProject.class) @RequestBody Project project, @CurrentUser LoginUser user, Errors errors) throws Exception { ValidateResult validateRes = projectService.validatePermision(user, project, errors) .addAssert(() -> projectService.deleteCheck(project.getId())) .addAssert(() -> projectService.deleteDataCenter(user, project)) .addAssert(() -> projectService.deleteProject(project).getCode() == 200, message.db_message_delete_operation_failed).validate(); if (!validateRes.isValid()) { return ServiceResult.fail(validateRes.getSummarize()); } return ServiceResult.success(); }  @RequestMapping(value = "/projects") ServiceResult<List<Project>> getProjects(@RequestParam(value = "name", defaultValue = "") String name); @RequestMapping(value = "/projectsNoGroup") ServiceResult<List<Project>> getProjectsNoGroup(@RequestParam(value = "appGroupId", defaultValue = "0") Long appGroupId); @RequestMapping(value = "/projectsByAppGroupId") ServiceResult<List<Project>> getProjectsByAppGroupId(@RequestParam(value = "appGroupId") Long appGroupId); @RequestMapping(value = "/group") ServiceResult<List<Project>> getGroupProjects(@RequestParam("groupId") Long groupId); @RequestMapping(value = "/list", method = RequestMethod.POST) ServiceResult<ListResult<ProjectView>> getGroupUsers(@RequestBody Paging<ProjectModel> paging, @CurrentUser LoginUser user); @RequestMapping(value = "/add", method = RequestMethod.POST) ServiceResult<String> add(@Validated(AddProject.class) @RequestBody Project project, @CurrentUser LoginUser user, Errors errors); @RequestMapping(value = "/update", method = RequestMethod.PUT) ServiceResult<String> update(@Validated(UpdateProject.class) @RequestBody Project project, @CurrentUser LoginUser user, Errors errors); @RequestMapping(value = "/delete", method = RequestMethod.DELETE) ServiceResult<String> delete(@Validated(DeleteProject.class) @RequestBody Project project, @CurrentUser LoginUser user, Errors errors); @RequestMapping(value = "/sync") ServiceResult<String> sync(@RequestParam("id") Long id, @CurrentUser LoginUser user); @RequestMapping(value = "/check") ConfigCkeckResult check(@CurrentUser LoginUser user, @RequestParam("id") Long id); @RequestMapping(value = "/syncdb") ServiceResult<String> syncdb(@Validated(AddProject.class) @RequestBody Project project, @CurrentUser LoginUser user, Errors errors); @RequestMapping(value = "/generate", method = RequestMethod.POST) ServiceResult generateProject(@CurrentUser LoginUser user, @RequestBody GenerateCodeModel generateCodeRequest); @RequestMapping("/download") String download(@RequestParam(value = "projectId") Long projectId, @CurrentUser LoginUser user, HttpServletResponse response); @RequestMapping("/buttons") ServiceResult getProjectButton(@CurrentUser LoginUser user);  }
@Test public void delete() throws Exception { mockMvc.perform(MockMvcRequestBuilders.delete("/project/delete") .contentType(MediaType.APPLICATION_JSON_UTF8) .content(requestJson) .accept(MediaType.APPLICATION_JSON_UTF8)) .andExpect(MockMvcResultMatchers.status().isOk()) .andDo(MockMvcResultHandlers.print()); }