### Question:
ModifyPageAccessValidator extends ModifyAccessValidator { @Override public ValidationResult validate(boolean simulate) { ValidationResult resourceResult = super.validate(simulate); if (!resourceResult.isSuccessful()) { return resourceResult; } if (!pageExists()) { return new ValidationResult(false, true, "Page not found"); } return canModifyPageWithUser(); } ModifyPageAccessValidator(Group group, Resource resource, AccessValidatorContext context, boolean checkAccessGranted); @Override ValidationResult validate(boolean simulate); @Override String getLabel();  }### Answer:
@Test public void validate_granted() throws RepositoryException { Collection<String> actions = Arrays.asList(BaseAccessRightsValidator.RIGHT_MODIFY); 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()); }