@Test
public void test_isValidPolicyItemAccess_failures() {

	
	Set<String> validAccesses = Sets.newHashSet(new String[] { "anAccess", "anotherAccess" });
	// null/empty names are invalid
	RangerPolicyItemAccess access = mock(RangerPolicyItemAccess.class);
	when(access.getIsAllowed()).thenReturn(null); // valid since null == true
	for (String type : new String[] { null, " 	"}) {
		when(access.getType()).thenReturn(type); // invalid
		// null/empty validAccess set skips all checks
		Assert.assertTrue(_validator.isValidPolicyItemAccess(access, _failures, null));
		Assert.assertTrue(_validator.isValidPolicyItemAccess(access, _failures, new HashSet<String>()));
		_failures.clear(); Assert.assertFalse(_validator.isValidPolicyItemAccess(access, _failures, validAccesses));
		_utils.checkFailureForMissingValue(_failures, "policy item access type");
	}
	
	when(access.getType()).thenReturn("anAccess"); // valid
	when(access.getIsAllowed()).thenReturn(false); // invalid
	_failures.clear();Assert.assertFalse(_validator.isValidPolicyItemAccess(access, _failures, validAccesses));
	_utils.checkFailureForSemanticError(_failures, "policy item access type allowed");
	
	when(access.getType()).thenReturn("newAccessType"); // invalid
	_failures.clear(); Assert.assertFalse(_validator.isValidPolicyItemAccess(access, _failures, validAccesses));
	_utils.checkFailureForSemanticError(_failures, "policy item access type");
}