use of org.kie.workbench.common.dmn.client.editors.included.DMNIncludedModelActiveRecord in project kie-wb-common by kiegroup.
the class ImportFactoryTest method testNameWithExistingName.
@Test
public void testNameWithExistingName() {
final Import import1 = mock(Import.class);
final Import import2 = mock(Import.class);
final Import import3 = mock(Import.class);
final List<Import> imports = asList(import1, import2, import3);
final DMNIncludedModelActiveRecord record = new DMNIncludedModelActiveRecord(null);
when(import1.getName()).thenReturn(new Name("foo"));
when(import2.getName()).thenReturn(new Name("bar"));
when(import3.getName()).thenReturn(new Name("foo bar"));
when(modelsIndex.getIndexedImports()).thenReturn(imports);
record.setName("foo");
final Name name = factory.name(record);
final String expected = "foo - 2";
final String actual = name.getValue();
assertEquals(expected, actual);
}
Aggregations