@Test public void testMakeEditExpressionEvent() { final ClientSession currentSession = mock(ClientSession.class); final HasName hasName = mock(HasName.class); final HasExpression hasExpression = mock(HasExpression.class); final View view = mock(View.class); final String uuid = "uuid"; when(node.getUUID()).thenReturn(uuid); when(sessionManager.getCurrentSession()).thenReturn(currentSession); when(node.getContent()).thenReturn(view); when(view.getDefinition()).thenReturn(hasName); when(boxedExpressionHelper.getHasExpression(node)).thenReturn(hasExpression); final EditExpressionEvent expressionEvent = factory.makeEditExpressionEvent(node); assertEquals(uuid, expressionEvent.getNodeUUID()); assertEquals(currentSession, expressionEvent.getSession()); assertEquals(Optional.of(hasName), expressionEvent.getHasName()); assertEquals(hasExpression, expressionEvent.getHasExpression()); assertFalse(expressionEvent.isOnlyVisualChangeAllowed()); }
EditExpressionEvent makeEditExpressionEvent(final Node<View, Edge> node) { final ClientSession currentSession = sessionManager.getCurrentSession(); final Object definition = DefinitionUtils.getElementDefinition(node); final HasExpression hasExpression = helper.getHasExpression(node); final Optional<HasName> hasName = Optional.of((HasName) definition); final boolean isOnlyVisualChangeAllowed = isOnlyVisualChangeAllowed(definition); return new EditExpressionEvent(currentSession, node.getUUID(), hasExpression, hasName, isOnlyVisualChangeAllowed); }
DecisionNavigatorNestedItemFactory { EditExpressionEvent makeEditExpressionEvent(final Node<View, Edge> node) { final ClientSession currentSession = sessionManager.getCurrentSession(); final Object definition = DefinitionUtils.getElementDefinition(node); final HasExpression hasExpression = helper.getHasExpression(node); final Optional<HasName> hasName = Optional.of((HasName) definition); final boolean isOnlyVisualChangeAllowed = isOnlyVisualChangeAllowed(definition); return new EditExpressionEvent(currentSession, node.getUUID(), hasExpression, hasName, isOnlyVisualChangeAllowed); } }
DecisionNavigatorNestedItemFactory { EditExpressionEvent makeEditExpressionEvent(final Node<View, Edge> node) { final ClientSession currentSession = sessionManager.getCurrentSession(); final Object definition = DefinitionUtils.getElementDefinition(node); final HasExpression hasExpression = helper.getHasExpression(node); final Optional<HasName> hasName = Optional.of((HasName) definition); final boolean isOnlyVisualChangeAllowed = isOnlyVisualChangeAllowed(definition); return new EditExpressionEvent(currentSession, node.getUUID(), hasExpression, hasName, isOnlyVisualChangeAllowed); } @Inject  DecisionNavigatorNestedItemFactory(final SessionManager sessionManager,
                                              final Event<EditExpressionEvent> editExpressionEvent,
                                              final DMNGraphUtils dmnGraphUtils,
                                              final @DMNEditor Supplier<ExpressionEditorDefinitions> expressionEditorDefinitionsSupplier,
                                              final Event<CanvasSelectionEvent> canvasSelectionEvent,
                                              final BoxedExpressionHelper helper); }
DecisionNavigatorNestedItemFactory { EditExpressionEvent makeEditExpressionEvent(final Node<View, Edge> node) { final ClientSession currentSession = sessionManager.getCurrentSession(); final Object definition = DefinitionUtils.getElementDefinition(node); final HasExpression hasExpression = helper.getHasExpression(node); final Optional<HasName> hasName = Optional.of((HasName) definition); final boolean isOnlyVisualChangeAllowed = isOnlyVisualChangeAllowed(definition); return new EditExpressionEvent(currentSession, node.getUUID(), hasExpression, hasName, isOnlyVisualChangeAllowed); } @Inject  DecisionNavigatorNestedItemFactory(final SessionManager sessionManager,
                                              final Event<EditExpressionEvent> editExpressionEvent,
                                              final DMNGraphUtils dmnGraphUtils,
                                              final @DMNEditor Supplier<ExpressionEditorDefinitions> expressionEditorDefinitionsSupplier,
                                              final Event<CanvasSelectionEvent> canvasSelectionEvent,
                                              final BoxedExpressionHelper helper); DecisionNavigatorItem makeItem(final Node<View, Edge> node); boolean hasNestedElement(final Node<View, Edge> node); }
DecisionNavigatorNestedItemFactory { EditExpressionEvent makeEditExpressionEvent(final Node<View, Edge> node) { final ClientSession currentSession = sessionManager.getCurrentSession(); final Object definition = DefinitionUtils.getElementDefinition(node); final HasExpression hasExpression = helper.getHasExpression(node); final Optional<HasName> hasName = Optional.of((HasName) definition); final boolean isOnlyVisualChangeAllowed = isOnlyVisualChangeAllowed(definition); return new EditExpressionEvent(currentSession, node.getUUID(), hasExpression, hasName, isOnlyVisualChangeAllowed); } @Inject  DecisionNavigatorNestedItemFactory(final SessionManager sessionManager,
                                              final Event<EditExpressionEvent> editExpressionEvent,
                                              final DMNGraphUtils dmnGraphUtils,
                                              final @DMNEditor Supplier<ExpressionEditorDefinitions> expressionEditorDefinitionsSupplier,
                                              final Event<CanvasSelectionEvent> canvasSelectionEvent,
                                              final BoxedExpressionHelper helper); DecisionNavigatorItem makeItem(final Node<View, Edge> node); boolean hasNestedElement(final Node<View, Edge> node);  }