GroupDatabaseController { @RequestMapping(value = "/update", method = RequestMethod.PUT) public ServiceResult<String> update(@Validated(UpdateGroupDB.class) @RequestBody DataBaseInfo dataBaseInfo, @CurrentUser LoginUser user, Errors errors) throws Exception { dataBaseInfo.setUpdateUserNo(user.getUserNo()); ValidateResult validateRes = groupDatabaseService.validatePermision(user, errors) .addAssert(() -> groupDatabaseService.isGroupHadDB(dataBaseInfo.getId(), dataBaseInfo.getDal_group_id()), message.message_operation_pemission) .addAssert(() -> dataBaseDao.updateDataBaseInfo(dataBaseInfo.getId(), dataBaseInfo.getComment()) > 0, message.db_message_update_operation_failed).validate(); if (!validateRes.isValid()) { return ServiceResult.fail(validateRes.getSummarize()); } return ServiceResult.success(); }  @RequestMapping(value = "/dblist") ServiceResult<List<DataBaseInfo>> getDBListByGroupId(@RequestParam("groupId") Long id); @RequestMapping(value = "/add", method = RequestMethod.POST) ServiceResult<String> add(@Validated(AddGroupDB.class) @RequestBody DataBaseInfo dataBaseInfo, @CurrentUser LoginUser user, Errors errors); @RequestMapping(value = "/update", method = RequestMethod.PUT) ServiceResult<String> update(@Validated(UpdateGroupDB.class) @RequestBody DataBaseInfo dataBaseInfo, @CurrentUser LoginUser user, Errors errors); @RequestMapping(value = "/delete", method = RequestMethod.DELETE) ServiceResult<String> delete(@Validated(DeleteGroupDB.class) @RequestBody DataBaseInfo dataBaseInfo, @CurrentUser LoginUser user, Errors errors); @RequestMapping(value = "/transfer", method = RequestMethod.PUT) ServiceResult<String> transfer(@Validated(TransferGroupDB.class) @RequestBody DataBaseInfo dataBaseInfo, @CurrentUser LoginUser user, Errors errors);  }
@Test public void update() throws Exception { mockMvc.perform(MockMvcRequestBuilders.put("/groupdb/update") .contentType(MediaType.APPLICATION_JSON_UTF8) .content(requestJson) .accept(MediaType.APPLICATION_JSON_UTF8)) .andExpect(MockMvcResultMatchers.status().isOk()) .andDo(MockMvcResultHandlers.print()); }