use of org.kie.workbench.common.dmn.client.editors.common.messages.FlashMessage in project kie-wb-common by kiegroup.
the class ImportRecordEngineTest method testIsValidWhenNameIsNotUnique.
@Test
public void testIsValidWhenNameIsNotUnique() {
final BaseIncludedModelActiveRecord record = mock(BaseIncludedModelActiveRecord.class);
final Import import1 = mock(Import.class);
final Import import2 = mock(Import.class);
final Name name1 = mock(Name.class);
final Name name2 = mock(Name.class);
final FlashMessage flashMessage = mock(FlashMessage.class);
final List<Import> imports = new ArrayList<>(asList(import1, import2));
when(name1.getValue()).thenReturn("file1");
when(name2.getValue()).thenReturn("file2");
when(record.getName()).thenReturn("file1");
when(import1.getName()).thenReturn(name1);
when(import2.getName()).thenReturn(name2);
when(includedModelsIndex.getImport(record)).thenReturn(import2);
when(stateProvider.getImports()).thenReturn(imports);
when(messageFactory.getNameIsNotUniqueFlashMessage(record)).thenReturn(flashMessage);
final boolean valid = recordEngine.isValid(record);
assertFalse(valid);
verify(flashMessageEvent).fire(flashMessage);
}
Aggregations