### Question:
ExpressionEditor implements ExpressionEditorView.Presenter { @Override public void setExpression(final String nodeUUID, final HasExpression hasExpression, final Optional<HasName> hasName, final boolean isOnlyVisualChangeAllowed) { this.hasExpression = Optional.ofNullable(hasExpression); view.setExpression(nodeUUID, hasExpression, hasName, isOnlyVisualChangeAllowed); view.setReturnToLinkText(returnToLinkTextSupplier.get()); toolbarStateHandler.ifPresent(ToolbarStateHandler::enterGridView); } @SuppressWarnings("unchecked")  ExpressionEditor(final ExpressionEditorView view,
                            final DecisionNavigatorPresenter decisionNavigator,
                            final DMNGraphUtils dmnGraphUtils,
                            final DMNDiagramsSession dmnDiagramsSession,
                            final DRDNameChanger drdNameChanger); @Override HTMLElement getElement(); @Override void bind(final DMNSession session); @Override ExpressionEditorView getView(); @Override void setToolbarStateHandler(final ToolbarStateHandler toolbarStateHandler); @Override void setExpression(final String nodeUUID,
                              final HasExpression hasExpression,
                              final Optional<HasName> hasName,
                              final boolean isOnlyVisualChangeAllowed); @Override void setExitCommand(final Command exitCommand); @Override void exit(); @Override void handleCanvasElementUpdated(final CanvasElementUpdatedEvent event); @Override boolean isActive();  }### Answer:
@Test @SuppressWarnings("unchecked") public void testSetExpression() { when(dmnDiagramsSession.isGlobalGraphSelected()).thenReturn(true); setupExpression(decision, decision, toolbarStateHandler, false); verify(view).setExpression(eq(NODE_UUID), eq(decision), eq(Optional.of(decision)), eq(false)); verify(view).setReturnToLinkText(eq(DRG_NAME)); verify(toolbarStateHandler).enterGridView(); }
@Test @SuppressWarnings("unchecked") public void testSetExpressionWhenOnlyVisualChangeAllowed() { when(dmnDiagramsSession.isGlobalGraphSelected()).thenReturn(true); setupExpression(decision, decision, toolbarStateHandler, true); verify(view).setExpression(eq(NODE_UUID), eq(decision), eq(Optional.of(decision)), eq(true)); verify(view).setReturnToLinkText(eq(DRG_NAME)); verify(toolbarStateHandler).enterGridView(); }