### Question:
RangerServiceDefValidator extends RangerValidator { boolean isValidPolicyConditions(List<RangerPolicyConditionDef> policyConditions, List<ValidationFailureDetails> failures) { if(LOG.isDebugEnabled()) { LOG.debug(String.format("==> RangerServiceDefValidator.isValidPolicyConditions(%s, %s)", policyConditions, failures)); } boolean valid = true; if (CollectionUtils.isEmpty(policyConditions)) { LOG.debug("Configs collection was null/empty! ok"); } else { Set<Long> ids = new HashSet<Long>(); Set<String> names = new HashSet<String>(); for (RangerPolicyConditionDef conditionDef : policyConditions) { valid = isUnique(conditionDef.getItemId(), ids, "policy condition def itemId", "policy condition defs", failures) && valid; String name = conditionDef.getName(); valid = isUnique(name, names, "policy condition def name", "policy condition defs", failures) && valid; if (StringUtils.isBlank(conditionDef.getEvaluator())) { ValidationErrorCode error = ValidationErrorCode.SERVICE_DEF_VALIDATION_ERR_POLICY_CONDITION_NULL_EVALUATOR; failures.add(new ValidationFailureDetailsBuilder() .field("policy condition def evaluator") .subField(name) .isMissing() .errorCode(error.getErrorCode()) .becauseOf(error.getMessage(name)) .build()); valid = false; } } } if(LOG.isDebugEnabled()) { LOG.debug(String.format("<== RangerServiceDefValidator.isValidPolicyConditions(%s, %s): %s", policyConditions, failures, valid)); } return valid; } RangerServiceDefValidator(ServiceStore store); void validate(final RangerServiceDef serviceDef, final Action action);  }### Answer:
@Test public final void test_isValidPolicyConditions() { assertTrue(_validator.isValidPolicyConditions(null, _failures)); assertTrue(_failures.isEmpty()); List<RangerPolicyConditionDef> conditionDefs = new ArrayList<RangerServiceDef.RangerPolicyConditionDef>(); assertTrue(_validator.isValidPolicyConditions(conditionDefs, _failures)); assertTrue(_failures.isEmpty()); Object[][] policyCondition_data = { { null, null, null}, { 1L, "condition-1", null }, { 1L, "condition-2", "" }, { 2L, "condition-1", "com.evaluator" }, }; conditionDefs.addAll(_utils.createPolicyConditionDefs(policyCondition_data)); _failures.clear(); assertFalse(_validator.isValidPolicyConditions(conditionDefs, _failures)); _utils.checkFailureForMissingValue(_failures, "policy condition def itemId"); _utils.checkFailureForMissingValue(_failures, "policy condition def name"); _utils.checkFailureForMissingValue(_failures, "policy condition def evaluator"); _utils.checkFailureForSemanticError(_failures, "policy condition def itemId", "1"); _utils.checkFailureForSemanticError(_failures, "policy condition def name", "condition-1"); _utils.checkFailureForMissingValue(_failures, "policy condition def evaluator", "condition-2"); _utils.checkFailureForMissingValue(_failures, "policy condition def evaluator", "condition-1"); }