AppGroupService { 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<AppGroupView> findProjectGroupPageList(Paging<AppGroup> paging); ServiceResult<String> insertAppGroup(AppGroup appGroup); ServiceResult deleteCheck(Long dbsetId); ServiceResult<String> deleteAppGroup(AppGroup appGroup); ServiceResult<String> updateAppGroup(AppGroup appGroup); boolean isNotExistByName(AppGroup appGroup);  }
@Test public void validatePermisionTest() throws Exception { LoginUser user = LoginUser.builder().id(1L).build(); DasGroup dasGroup = DasGroup.builder().group_name("name").build(); Errors errors = new BeanPropertyBindingResult(dasGroup, "dasGroup", true, 256); ValidatorChain chain = appGroupService.validatePermision(user, errors); Assert.assertTrue(chain.validate().isValid()); }