Search in sources :

Example 1 with SessionCommandManager

use of org.kie.workbench.common.stunner.core.client.command.SessionCommandManager in project kie-wb-common by kiegroup.

the class DeleteNodeActionTest method testSkipAction.

@Test
@SuppressWarnings("unchecked")
public void testSkipAction() {
    this.tested = new DeleteNodeAction(translationService, sessionCommandManager, commandFactory, action -> false);
    final MouseClickEvent event = mock(MouseClickEvent.class);
    ToolboxAction<AbstractCanvasHandler> cascade = tested.onMouseClick(canvasHandler, E_UUID, event);
    assertEquals(tested, cascade);
    verify(sessionCommandManager, never()).execute(eq(canvasHandler), any(CanvasCommand.class));
}
Also used : GwtMockitoTestRunner(com.google.gwtmockito.GwtMockitoTestRunner) CanvasCommandFactory(org.kie.workbench.common.stunner.core.client.command.CanvasCommandFactory) Mock(org.mockito.Mock) Index(org.kie.workbench.common.stunner.core.graph.processing.index.Index) RunWith(org.junit.runner.RunWith) Test(org.junit.Test) AbstractCanvasHandler(org.kie.workbench.common.stunner.core.client.canvas.AbstractCanvasHandler) Mockito.times(org.mockito.Mockito.times) Mockito.when(org.mockito.Mockito.when) SessionCommandManager(org.kie.workbench.common.stunner.core.client.command.SessionCommandManager) Mockito.verify(org.mockito.Mockito.verify) CanvasCommand(org.kie.workbench.common.stunner.core.client.command.CanvasCommand) ClientTranslationService(org.kie.workbench.common.stunner.core.client.i18n.ClientTranslationService) MouseClickEvent(org.kie.workbench.common.stunner.core.client.shape.view.event.MouseClickEvent) CoreTranslationMessages(org.kie.workbench.common.stunner.core.i18n.CoreTranslationMessages) Mockito.never(org.mockito.Mockito.never) Matchers.eq(org.mockito.Matchers.eq) Mockito.any(org.mockito.Mockito.any) Node(org.kie.workbench.common.stunner.core.graph.Node) Assert.assertEquals(org.junit.Assert.assertEquals) Before(org.junit.Before) Mockito.mock(org.mockito.Mockito.mock) AbstractCanvasHandler(org.kie.workbench.common.stunner.core.client.canvas.AbstractCanvasHandler) MouseClickEvent(org.kie.workbench.common.stunner.core.client.shape.view.event.MouseClickEvent) CanvasCommand(org.kie.workbench.common.stunner.core.client.command.CanvasCommand) Test(org.junit.Test)

Aggregations

GwtMockitoTestRunner (com.google.gwtmockito.GwtMockitoTestRunner)1 Assert.assertEquals (org.junit.Assert.assertEquals)1 Before (org.junit.Before)1 Test (org.junit.Test)1 RunWith (org.junit.runner.RunWith)1 AbstractCanvasHandler (org.kie.workbench.common.stunner.core.client.canvas.AbstractCanvasHandler)1 CanvasCommand (org.kie.workbench.common.stunner.core.client.command.CanvasCommand)1 CanvasCommandFactory (org.kie.workbench.common.stunner.core.client.command.CanvasCommandFactory)1 SessionCommandManager (org.kie.workbench.common.stunner.core.client.command.SessionCommandManager)1 ClientTranslationService (org.kie.workbench.common.stunner.core.client.i18n.ClientTranslationService)1 MouseClickEvent (org.kie.workbench.common.stunner.core.client.shape.view.event.MouseClickEvent)1 Node (org.kie.workbench.common.stunner.core.graph.Node)1 Index (org.kie.workbench.common.stunner.core.graph.processing.index.Index)1 CoreTranslationMessages (org.kie.workbench.common.stunner.core.i18n.CoreTranslationMessages)1 Matchers.eq (org.mockito.Matchers.eq)1 Mock (org.mockito.Mock)1 Mockito.any (org.mockito.Mockito.any)1 Mockito.mock (org.mockito.Mockito.mock)1 Mockito.never (org.mockito.Mockito.never)1 Mockito.times (org.mockito.Mockito.times)1