ServerConfigService { 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<ServerConfig> findServerAppConfigPageList(Paging<ServerConfig> paging);  }
@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(serverConfigService.validatePermision(user, errors).validate().isValid()); }