}
@Test
public void testUpdate() throws Exception {
QName name = new QName(namespace, "testUpdate");
ValueType valueType = typeManager.getValueType("STRING");
FieldType fieldTypeCreate = typeManager.newFieldType(valueType , name, Scope.VERSIONED);
fieldTypeCreate = typeManager.createFieldType(fieldTypeCreate);
// Update name
FieldType fieldTypeNewName = typeManager.newFieldType(fieldTypeCreate.getId(), valueType , new QName(namespace, "newName"), Scope.VERSIONED);
fieldTypeNewName = typeManager.updateFieldType(fieldTypeNewName);
assertEquals(fieldTypeCreate.getId(), fieldTypeNewName.getId());
assertEquals(fieldTypeNewName, typeManager.getFieldTypeById(fieldTypeCreate.getId()));
assertEquals(typeManager.getFieldTypeById(fieldTypeCreate.getId()), typeManager.getFieldTypeByName(new QName(namespace, "newName")));
// Create new fieldType with first name
ValueType valueType2 = typeManager.getValueType("INTEGER");
FieldType fieldType2 = typeManager.newFieldType(valueType2 , name, Scope.NON_VERSIONED);
fieldType2 = typeManager.createFieldType(fieldTypeCreate);
assertEquals(fieldType2, typeManager.getFieldTypeByName(name));
}