private void handleError(PromiseError error) {
   view.showLoader(false);
   final ServiceError serviceError =
       dtoFactory.createDtoFromJson(error.getMessage(), ServiceError.class);
   notificationManager.notify(serviceError.getMessage(), FAIL, true);
   view.showError(serviceError.getMessage());
 }
Exemplo n.º 2
0
  @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);
  }