Search in sources :

Example 11 with DMNIncludedModelActiveRecord

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);
}
Also used : Import(org.kie.workbench.common.dmn.api.definition.model.Import) DMNIncludedModelActiveRecord(org.kie.workbench.common.dmn.client.editors.included.DMNIncludedModelActiveRecord) Name(org.kie.workbench.common.dmn.api.property.dmn.Name) Test(org.junit.Test)

Aggregations

DMNIncludedModelActiveRecord (org.kie.workbench.common.dmn.client.editors.included.DMNIncludedModelActiveRecord)11 Test (org.junit.Test)7 Import (org.kie.workbench.common.dmn.api.definition.model.Import)5 BaseIncludedModelActiveRecord (org.kie.workbench.common.dmn.client.editors.included.BaseIncludedModelActiveRecord)5 ImportDMN (org.kie.workbench.common.dmn.api.definition.model.ImportDMN)4 Name (org.kie.workbench.common.dmn.api.property.dmn.Name)4 PMMLIncludedModelActiveRecord (org.kie.workbench.common.dmn.client.editors.included.PMMLIncludedModelActiveRecord)4 DefaultIncludedModelActiveRecord (org.kie.workbench.common.dmn.client.editors.included.DefaultIncludedModelActiveRecord)3 ImportPMML (org.kie.workbench.common.dmn.api.definition.model.ImportPMML)2 LocationURI (org.kie.workbench.common.dmn.api.property.dmn.LocationURI)2 KieAssetsDropdownItem (org.kie.workbench.common.widgets.client.assets.dropdown.KieAssetsDropdownItem)2 Maps (org.kie.soup.commons.util.Maps)1 RefreshDecisionComponents (org.kie.workbench.common.dmn.client.docks.navigator.events.RefreshDecisionComponents)1 Mockito.doAnswer (org.mockito.Mockito.doAnswer)1 InvocationOnMock (org.mockito.invocation.InvocationOnMock)1 Answer (org.mockito.stubbing.Answer)1