use of org.kie.workbench.common.dmn.api.editors.types.DataObjectProperty in project kie-wb-common by kiegroup.
the class DataTypeListTest method testUpdatePropertiesReferences.
@Test
public void testUpdatePropertiesReferences() {
final List<DataObject> imported = new ArrayList<>();
final HashMap<String, String> renamed = new HashMap<>();
final String propertyType1 = "type";
final String propertyNewType1 = "type-1";
final String uniqueType = "uniqueType";
renamed.put(propertyType1, propertyNewType1);
final DataObjectProperty prop1 = mock(DataObjectProperty.class);
final DataObjectProperty prop2 = mock(DataObjectProperty.class);
when(prop1.getType()).thenReturn(propertyType1);
when(prop2.getType()).thenReturn(uniqueType);
doReturn(true).when(dataTypeList).isPropertyTypePresent(uniqueType, imported);
doReturn(true).when(dataTypeList).isPropertyTypePresent(propertyNewType1, imported);
final DataObject do1 = new DataObject();
do1.setProperties(Arrays.asList(prop1, prop2));
imported.add(do1);
dataTypeList.updatePropertiesReferences(imported, renamed);
verify(prop1).setType(propertyNewType1);
verify(prop2).setType(uniqueType);
verify(dataTypeList).isPropertyTypePresent(propertyNewType1, imported);
verify(dataTypeList).isPropertyTypePresent(uniqueType, imported);
}
Aggregations