ServerGroupService { public ValidatorChain validatePermision(LoginUser user, Errors errors) { return ValidatorChain.newInstance().controllerValidate(errors) .addAssert(() -> permissionService.isManagerById(user.getId()), message.permisson_user_crud); }  ValidatorChain validatePermision(LoginUser user, Errors errors); ListResult<ServerGroupView> findServerGroupPageList(Paging<ServerGroup> paging); ServiceResult deleteCheck(Long dbsetId); ServiceResult<String> deleteServerGroup(ServerGroup serverGroup); boolean isNotExistByName(ServerGroup serverGroup); ServiceResult<String> addDataCenter(LoginUser user, ServerGroup serverGroup); ServiceResult<String> updateDataCenter(LoginUser user, ServerGroup serverGroup); ServiceResult<String> deleteDataCenter(LoginUser user, ServerGroup serverGroup); ServiceResult<String> syncDataCenter(LoginUser user, ServerGroup serverGroup); List<ConfigDataResponse> getCheckData(LoginUser user, ServerGroup serverGroup);  }
@Test public void validatePermisionTest() throws SQLException { LoginUser user = LoginUser.builder().id(1L).build(); ServerConfig serverConfig = ServerConfig.builder().id(1L).build(); Errors errors = new BeanPropertyBindingResult(serverConfig, "serverConfig", true, 256); Assert.assertTrue(serverGroupService.validatePermision(user, errors).validate().isValid()); }