ServerService { 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<ServerView> findServerPageList(Paging<Server> paging); ServiceResult insertServer(Server server); ServiceResult<String> deleteServer(Server server); ServiceResult<String> addDataCenter(LoginUser user, Server server); ServiceResult<String> updateDataCenter(LoginUser user, Server server); ServiceResult<String> deleteDataCenter(LoginUser user, Server server); ServiceResult<String> syncDataCenter(LoginUser user, Server server); List<ConfigDataResponse> getCheckData(LoginUser user, Server server);  }
@Test public void validatePermisionTest() throws SQLException { LoginUser user = LoginUser.builder().id(1L).build(); Server server = Server.builder().id(1L).build(); Errors errors = new BeanPropertyBindingResult(server, "server", true, 256); Assert.assertTrue(serverService.validatePermision(user, errors).validate().isValid()); }