use of org.kie.workbench.common.dmn.client.editors.included.BaseIncludedModelActiveRecord in project kie-wb-common by kiegroup.
the class IncludedModelErrorMessageFactoryTest method testGetNameIsBlankFlashMessage.
@Test
public void testGetNameIsBlankFlashMessage() {
final BaseIncludedModelActiveRecord includedModel = mock(BaseIncludedModelActiveRecord.class);
final Type expectedType = ERROR;
final String expectedStrongMessage = "StrongMessage";
final String expectedRegularMessage = "RegularMessage";
final String expectedElementSelector = "[data-card-uuid=\"1234\"] [data-field=\"title-input\"]";
when(includedModel.getUUID()).thenReturn("1234");
when(translationService.format(IncludedModelNameIsBlankErrorMessage_StrongMessage)).thenReturn(expectedStrongMessage);
when(translationService.format(IncludedModelNameIsBlankErrorMessage_RegularMessage)).thenReturn(expectedRegularMessage);
final FlashMessage flashMessage = factory.getNameIsBlankFlashMessage(includedModel);
assertEquals(expectedType, flashMessage.getType());
assertEquals(expectedStrongMessage, flashMessage.getStrongMessage());
assertEquals(expectedRegularMessage, flashMessage.getRegularMessage());
assertEquals(expectedElementSelector, flashMessage.getElementSelector());
}
use of org.kie.workbench.common.dmn.client.editors.included.BaseIncludedModelActiveRecord in project kie-wb-common by kiegroup.
the class DefinitionsHandlerTest method testCreate.
@Test
public void testCreate() {
final BaseIncludedModelActiveRecord includedModel = mock(BaseIncludedModelActiveRecord.class);
final String newNamespace = "://namespace2";
when(includedModel.getNamespace()).thenReturn(newNamespace);
handler.create(includedModel);
assertEquals(2, nsContext.size());
assertTrue(nsContext.values().contains(namespace));
assertTrue(nsContext.values().contains(newNamespace));
}
use of org.kie.workbench.common.dmn.client.editors.included.BaseIncludedModelActiveRecord in project kie-wb-common by kiegroup.
the class DefinitionsHandlerTest method testDestroy.
@Test
public void testDestroy() {
final BaseIncludedModelActiveRecord includedModel = mock(BaseIncludedModelActiveRecord.class);
when(includedModel.getNamespace()).thenReturn(namespace);
handler.destroy(includedModel);
assertEquals(0, nsContext.size());
}
use of org.kie.workbench.common.dmn.client.editors.included.BaseIncludedModelActiveRecord in project kie-wb-common by kiegroup.
the class BaseCardComponentTest method testRemove.
@Test
public void testRemove() {
final DMNCardsGridComponent grid = mock(DMNCardsGridComponent.class);
final BaseIncludedModelActiveRecord includedModel = prepareIncludedModelMock();
doReturn(includedModel).when(card).getIncludedModel();
doReturn(grid).when(card).getGrid();
card.remove();
verify(includedModel).destroy();
verify(grid).refresh();
verify(refreshDecisionComponentsEvent).fire(Mockito.<RefreshDecisionComponents>any());
}
use of org.kie.workbench.common.dmn.client.editors.included.BaseIncludedModelActiveRecord in project kie-wb-common by kiegroup.
the class BaseCardComponentTest method testRefreshView.
@Test
public void testRefreshView() {
final BaseIncludedModelActiveRecord includedModel = prepareIncludedModelMock();
final String path = "/bla/bla/bla/111111111111111222222222222222333333333333333444444444444444/file.dmn";
when(includedModel.getNamespace()).thenReturn(path);
doReturn(includedModel).when(card).getIncludedModel();
card.refreshView();
verify(cardView).setPath("...111111222222222222222333333333333333444444444444444/file.dmn");
}
Aggregations