use of org.kie.workbench.common.dmn.client.resources.i18n.DMNEditorConstants.DecisionComponentsItemView_DuplicatedNode in project kie-wb-common by kiegroup.
the class DecisionComponentsItemViewTest method testMakeDragProxyCallbackImplWhenNodeIsDuplicated.
@Test
public void testMakeDragProxyCallbackImplWhenNodeIsDuplicated() {
final ShapeFactory factory = mock(ShapeFactory.class);
final DRGElement drgElement = mock(DRGElement.class);
final int x = 10;
final int y = 20;
final String expectedWarnMessage = "This 'DRGElement' already exists!";
final NotificationEvent.NotificationType expectedWarnType = WARNING;
final Graph<?, Node> graph = mock(Graph.class);
final List<Node> nodes = new ArrayList<>();
final String id1 = "123";
final String id2 = "123";
nodes.add(createNode(id1));
nodes.add(createNode(id2));
when(graph.nodes()).thenReturn(nodes);
when(drgElement.getId()).thenReturn(new Id(id1));
when(clientTranslationService.getValue(DecisionComponentsItemView_DuplicatedNode)).thenReturn(expectedWarnMessage);
doReturn(graph).when(view).getGraph();
view.setIsImported(true);
view.makeDragProxyCallbackImpl(drgElement, factory).onComplete(x, y);
verify(buildCanvasShapeEvent, never()).fire(any());
verify(notificationEvent).fire(notificationEventArgumentCaptor.capture());
final NotificationEvent notificationEvent = notificationEventArgumentCaptor.getValue();
assertEquals(expectedWarnMessage, notificationEvent.getNotification());
assertEquals(expectedWarnType, notificationEvent.getType());
}
Aggregations