@Test
public final void test_isValidName_update() throws Exception {

	
	// update: if service exists with the same name then it can't point to a different service
	long id = 7;
	when(_serviceDef.getId()).thenReturn(id);
	String name = "aServiceDef";
	when(_serviceDef.getName()).thenReturn(name);
	when(_store.getServiceDefByName(name)).thenReturn(null); // no service with the new name (we are updating the name to a unique value)
	assertTrue(_validator.isValidServiceDefName(name, id, Action.UPDATE, _failures));
	assertTrue(_failures.isEmpty());
	RangerServiceDef existingServiceDef = mock(RangerServiceDef.class);
	when(existingServiceDef.getId()).thenReturn(id);
	when(existingServiceDef.getName()).thenReturn(name);
	when(_store.getServiceDefByName(name)).thenReturn(existingServiceDef);
	assertTrue(_validator.isValidServiceDefName(name, id, Action.UPDATE, _failures));
	assertTrue(_failures.isEmpty());
	
	long anotherId = 49;
	when(existingServiceDef.getId()).thenReturn(anotherId);
	assertFalse(_validator.isValidServiceDefName(name, id, Action.UPDATE, _failures));
	_utils.checkFailureForSemanticError(_failures, "id/name");
}