### Question:
RangerPolicyValidator extends RangerValidator { boolean isValidPolicyItems(List<RangerPolicyItem> policyItems, List<ValidationFailureDetails> failures, RangerServiceDef serviceDef) { if(LOG.isDebugEnabled()) { LOG.debug(String.format("==> RangerPolicyValidator.isValid(%s, %s, %s)", policyItems, failures, serviceDef)); } boolean valid = true; if (CollectionUtils.isEmpty(policyItems)) { LOG.debug("policy items collection was null/empty"); } else { for (RangerPolicyItem policyItem : policyItems) { if (policyItem == null) { ValidationErrorCode error = ValidationErrorCode.POLICY_VALIDATION_ERR_NULL_POLICY_ITEM; failures.add(new ValidationFailureDetailsBuilder() .field("policy item") .isMissing() .becauseOf(error.getMessage()) .errorCode(error.getErrorCode()) .build()); valid = false; } else { valid = isValidPolicyItem(policyItem, failures, serviceDef) && valid; } } } if(LOG.isDebugEnabled()) { LOG.debug(String.format("<== RangerPolicyValidator.isValid(%s, %s, %s): %s", policyItems, failures, serviceDef, valid)); } return valid; } RangerPolicyValidator(ServiceStore store); void validate(RangerPolicy policy, Action action, boolean isAdmin);  }### Answer:
@Test public void test_isValidPolicyItems_failures() { assertTrue(_validator.isValidPolicyItems(null, _failures, _serviceDef)); _failures.isEmpty(); List<RangerPolicyItem> policyItems = new ArrayList<RangerPolicy.RangerPolicyItem>(); assertTrue(_validator.isValidPolicyItems(policyItems, _failures, _serviceDef)); _failures.isEmpty(); policyItems.add(null); assertFalse(_validator.isValidPolicyItems(policyItems, _failures, _serviceDef)); _utils.checkFailureForMissingValue(_failures, "policy item"); }