@Override public void actionPerformed(ActionEvent e) { Debugger debugger = debuggerManager.getDebugger(); if (debugger != null) { debugger.stepOut(); } }
@Override public void update(ActionEvent e) { Debugger debugger = debuggerManager.getDebugger(); e.getPresentation() .setEnabled( debugger != null && debugger.getDebuggerState() == DebuggerState.CONNECTED && breakpointManager.getCurrentBreakpoint() != null); }
@Test public void testChangeValueRequest() throws Exception { when(debuggerManager.getActiveDebugger()).thenReturn(debugger); when(view.getValue()).thenReturn(VAR_VALUE); when(debuggerVariable.getVariablePath()).thenReturn(variablePath); when(variablePath.getPath()).thenReturn(new ArrayList<>()); presenter.onChangeClicked(); verify(debugger).changeVariableValue(anyObject(), anyString()); verify(view).close(); }
@Test public void testEvaluateExpressionRequestIsSuccessful() throws Exception { when(debugger.evaluate(anyString())).thenReturn(promise); when(view.getExpression()).thenReturn(EXPRESSION); when(promise.then(any(Operation.class))).thenReturn(promise); when(debuggerManager.getActiveDebugger()).thenReturn(debugger); presenter.showDialog(); presenter.onEvaluateClicked(); verify(view, atLeastOnce()).setEnableEvaluateButton(eq(DISABLE_BUTTON)); verify(debugger).evaluate(eq(EXPRESSION)); }
@Test public void testEvaluateExpressionRequestIsFailed() throws Exception { when(view.getExpression()).thenReturn(EXPRESSION); when(debugger.evaluate(view.getExpression())).thenReturn(promise); when(promise.then((Operation) anyObject())).thenReturn(promise); when(promise.catchError(Matchers.<Operation<PromiseError>>anyObject())).thenReturn(promise); when(debuggerManager.getActiveDebugger()).thenReturn(debugger); when(promiseError.getMessage()).thenReturn(FAIL_REASON); presenter.showDialog(); presenter.onEvaluateClicked(); verify(view, atLeastOnce()).setEnableEvaluateButton(eq(DISABLE_BUTTON)); verify(debugger).evaluate(eq(EXPRESSION)); verify(promise).catchError(errorCaptor.capture()); errorCaptor.getValue().apply(promiseError); verify(view).setEnableEvaluateButton(eq(!DISABLE_BUTTON)); verify(constants).evaluateExpressionFailed(FAIL_REASON); }