SelectEntityService { public ValidatorChain validatePermision(LoginUser user, TaskSql taskSql, Errors errors) { return ValidatorChain.newInstance().controllerValidate(errors) .addAssert(() -> this.validatePermision(taskSql.getProject_id(), user.getId()), message.permisson_user_crud); }  ValidatorChain validatePermision(LoginUser user, TaskSql taskSql, Errors errors); ListResult<TaskSqlView> findSelectEntityPageList(Paging<TaskSql> paging); Long insertTask(TaskSql task, LoginUser user);  }
@Test public void validatePermisionTest() throws SQLException { LoginUser user = LoginUser.builder().id(1L).build(); TaskSql taskSql = TaskSql.builder().id(1L).class_name("name").build(); Errors errors = new BeanPropertyBindingResult(taskSql, "taskSql", true, 256); Assert.assertTrue(selectEntityService.validatePermision(user, taskSql, errors).validate().isValid()); }