CreateAccessValidator extends BaseAccessRightsValidator { @Override public ValidationResult validate(boolean simulate) { return checkAction(RIGHT_CREATE); } CreateAccessValidator(Group group, Resource resource, AccessValidatorContext context, boolean checkAccessGranted); @Override ValidationResult validate(boolean simulate); @Override String getLabel();  }
@Test public void validate_granted() throws RepositoryException { Collection<String> actions = Arrays.asList(BaseAccessRightsValidator.RIGHT_CREATE); when(cqActions.getAllowedActions(Mockito.any(), Mockito.any())).thenReturn(actions); assertTrue(validator.validate(true).isSuccessful()); }
@Test public void validate_notGranted() throws RepositoryException { Collection<String> actions = Arrays.asList(); when(cqActions.getAllowedActions(Mockito.any(), Mockito.any())).thenReturn(actions); assertFalse(validator.validate(true).isSuccessful()); }