use of org.kie.workbench.common.dmn.client.events.EditExpressionEvent in project kie-wb-common by kiegroup.
the class DMNEditBusinessKnowledgeModelToolboxActionTest method testAction.
@Test
public void testAction() {
final ToolboxAction<AbstractCanvasHandler> cascade = tested.onMouseClick(canvasHandler, E_UUID, mouseClickEvent);
assertEquals(tested, cascade);
final ArgumentCaptor<EditExpressionEvent> eventCaptor = ArgumentCaptor.forClass(EditExpressionEvent.class);
verify(editExpressionEvent, times(1)).fire(eventCaptor.capture());
final EditExpressionEvent editExprEvent = eventCaptor.getValue();
assertEquals(E_UUID, editExprEvent.getNodeUUID());
final HasExpression hasExpression = editExprEvent.getHasExpression();
assertEquals(bkm.getEncapsulatedLogic(), hasExpression.getExpression());
assertEquals(bkm, hasExpression.asDMNModelInstrumentedBase());
assertFalse(hasExpression.isClearSupported());
assertEquals(bkm, editExprEvent.getHasName().get());
assertEquals(session, editExprEvent.getSession());
assertFalse(editExprEvent.isOnlyVisualChangeAllowed());
}
use of org.kie.workbench.common.dmn.client.events.EditExpressionEvent in project kie-wb-common by kiegroup.
the class DMNEditDecisionToolboxActionTest method testAction.
@Test
public void testAction() {
final MouseClickEvent event = mock(MouseClickEvent.class);
final ToolboxAction<AbstractCanvasHandler> cascade = tested.onMouseClick(canvasHandler, E_UUID, event);
assertEquals(tested, cascade);
final ArgumentCaptor<EditExpressionEvent> eventCaptor = ArgumentCaptor.forClass(EditExpressionEvent.class);
verify(editExpressionEvent, times(1)).fire(eventCaptor.capture());
final EditExpressionEvent editExprEvent = eventCaptor.getValue();
assertEquals(E_UUID, editExprEvent.getNodeUUID());
assertEquals(decision, editExprEvent.getHasExpression());
assertEquals(decision, editExprEvent.getHasName().get());
assertEquals(session, editExprEvent.getSession());
assertFalse(editExprEvent.isOnlyVisualChangeAllowed());
}
use of org.kie.workbench.common.dmn.client.events.EditExpressionEvent in project kie-wb-common by kiegroup.
the class DecisionNavigatorObserverTest method testOnNestedElementSelected.
@Test
public void testOnNestedElementSelected() {
observer.init(presenter);
observer.onNestedElementSelected(new EditExpressionEvent(clientSession, uuid, hasExpression, Optional.of(hasName), false));
verify(presenter).refresh();
}
use of org.kie.workbench.common.dmn.client.events.EditExpressionEvent in project kie-wb-common by kiegroup.
the class DecisionNavigatorObserverTest method testSelectItemWhenExpressionIsNull.
@Test
public void testSelectItemWhenExpressionIsNull() {
final EditExpressionEvent event = makeEditExpressionEvent();
when(hasExpression.getExpression()).thenReturn(null);
observer.init(presenter);
observer.selectItem(event.getHasExpression());
verify(treePresenter, never()).selectItem(Mockito.<String>any());
}
use of org.kie.workbench.common.dmn.client.events.EditExpressionEvent in project kie-wb-common by kiegroup.
the class DecisionNavigatorObserverTest method testSelectItemWhenExpressionIsNotNull.
@Test
public void testSelectItemWhenExpressionIsNotNull() {
final EditExpressionEvent event = makeEditExpressionEvent();
final Expression expression = mock(Expression.class);
final Id id = mock(Id.class);
when(hasExpression.getExpression()).thenReturn(expression);
when(expression.getId()).thenReturn(id);
when(id.getValue()).thenReturn(uuid);
observer.init(presenter);
observer.selectItem(event.getHasExpression());
verify(treePresenter).selectItem(uuid);
}
Aggregations