@Test
public final void test_isValidAccessTypes_failures() {

	long id = 7;
	when(_serviceDef.getId()).thenReturn(id);
	// null or empty access type defs
	List<RangerAccessTypeDef> accessTypeDefs = null;
	_failures.clear(); assertFalse(_validator.isValidAccessTypes(id, accessTypeDefs, _failures, Action.CREATE));
	_utils.checkFailureForMissingValue(_failures, "access types");
	
	accessTypeDefs = new ArrayList<>();
	_failures.clear(); assertFalse(_validator.isValidAccessTypes(id, accessTypeDefs, _failures, Action.CREATE));
	_utils.checkFailureForMissingValue(_failures, "access types");
	// null/empty access types
	accessTypeDefs = _utils.createAccessTypeDefs(new String[] { null, "", "		" });
	_failures.clear(); assertFalse(_validator.isValidAccessTypes(id, accessTypeDefs, _failures, Action.CREATE));
	_utils.checkFailureForMissingValue(_failures, "access type name");
	
	// duplicate access types
	accessTypeDefs = _utils.createAccessTypeDefs(new String[] { "read", "write", "execute", "read" } );
	_failures.clear(); assertFalse(_validator.isValidAccessTypes(id, accessTypeDefs, _failures, Action.CREATE));
	_utils.checkFailureForSemanticError(_failures, "access type name", "read");
	
	// duplicate access types - case-insensitive
	accessTypeDefs = _utils.createAccessTypeDefs(new String[] { "read", "write", "execute", "READ" } );
	_failures.clear(); assertFalse(_validator.isValidAccessTypes(id, accessTypeDefs, _failures, Action.CREATE));
	_utils.checkFailureForSemanticError(_failures, "access type name", "READ");
	
	// unknown access type in implied grants list
	accessTypeDefs = _utils.createAccessTypeDefs(accessTypes_bad_unknownType);
	_failures.clear(); assertFalse(_validator.isValidAccessTypes(id, accessTypeDefs, _failures, Action.CREATE));
	_utils.checkFailureForSemanticError(_failures, "implied grants", "execute");
	_utils.checkFailureForSemanticError(_failures, "access type itemId", "1"); // id 1 is duplicated
	
	// access type with implied grant referring to itself
	accessTypeDefs = _utils.createAccessTypeDefs(accessTypes_bad_selfReference);
	_failures.clear(); assertFalse(_validator.isValidAccessTypes(id, accessTypeDefs, _failures, Action.CREATE));
	_utils.checkFailureForSemanticError(_failures, "implied grants", "admin");
}