source: class TestRangerPolicyValidator {
  
  	final Action[] cu;
  	final Object[] policyItemsData;
  	 String[] accessTypes;
  	 String[] accessTypes_bad;
  	private final Object[][] resourceDefData;
  	private final Object[][] resourceDefData_multipleHierarchies;
  	private final Object[][] policyResourceMap_good;
  	private final Object[][] policyResourceMap_goodMultipleHierarchies;
  	private final Object[][] policyResourceMap_bad;
  	private final Object[][] policyResourceMap_bad_multiple_hierarchies;
  	private final Object[][] policyResourceMap_bad_multiple_hierarchies_missing_mandatory;
  	final Object[][] resourceDef_happyPath;
  	private Object[][] policyResourceMap_happyPath;
  	private Object[][] policyResourceMap_failures;
  	private ValidationTestUtils _utils;
  	private List<ValidationFailureDetails> _failures;
  	private ServiceStore _store;
  	private RangerPolicy _policy;
  	private RangerPolicyValidator _validator;
  	private RangerServiceDef _serviceDef;
  	private RangerObjectFactory _factory;
  	private Long _zoneId;
  
  	@Test
  	public final void test_isValidResourceNames_failures() {
  
target: 		String serviceName = "a-service-def";
  		// setup service-def
  		Date now = new Date();
  		when(_serviceDef.getName()).thenReturn(serviceName );
  		when(_serviceDef.getUpdateTime()).thenReturn(now);
  		List<RangerResourceDef> resourceDefs = _utils.createResourceDefs(resourceDefData_multipleHierarchies);
  		when(_serviceDef.getResources()).thenReturn(resourceDefs);
  		// setup policy
  		Map<String, RangerPolicyResource> policyResources = _utils.createPolicyResourceMap(policyResourceMap_bad);
  		when(_policy.getResources()).thenReturn(policyResources);
  		Assert.assertFalse("Missing required resource and unknown resource", _validator.isValidResourceNames(_policy, _failures, _serviceDef));
  		_utils.checkFailureForSemanticError(_failures, "policy resources");
  
  		// another bad resource map that straddles multiple hierarchies
  		policyResources = _utils.createPolicyResourceMap(policyResourceMap_bad_multiple_hierarchies);
  		when(_policy.getResources()).thenReturn(policyResources);
  		_failures.clear(); Assert.assertFalse("Policy with resources for multiple hierarchies", _validator.isValidResourceNames(_policy, _failures, _serviceDef));
  		_utils.checkFailureForSemanticError(_failures, "policy resources", "incompatible");
  
  		// another bad policy resource map that could match multiple hierarchies but is short on mandatory resources for all of those matches
  		policyResources = _utils.createPolicyResourceMap(policyResourceMap_bad_multiple_hierarchies_missing_mandatory);
  		when(_policy.getResources()).thenReturn(policyResources);
  		_failures.clear(); Assert.assertFalse("Policy with resources for multiple hierarchies missing mandatory resources for all pontential matches", _validator.isValidResourceNames(_policy, _failures, _serviceDef));
  		_utils.checkFailureForSemanticError(_failures, "policy resources", "missing mandatory");
  	}
  
  }