@Test
  public void testIsDirtyBuildAndDeploy() {
    model.setPOM(mock(POM.class)); // causes isDirty evaluates as true
    presenter.triggerBuildAndDeploy("usr", "psw", "url");

    verify(view, times(1))
        .showSaveBeforeContinue(any(Command.class), any(Command.class), any(Command.class));
    verify(notificationEvent, never()).fire(any(NotificationEvent.class));
    verifyBusyShowHideAnyString(1, 1);
  }
  @Test
  public void testAlreadyRunningBuildAndDeploy() {
    constructProjectScreenPresenter(
        new CallerMock<BuildService>(buildService), assetManagementCaller());

    presenter.onStartup(mock(PlaceRequest.class));

    presenter.triggerBuildAndDeploy("usr", "psw", "url");
    presenter.triggerBuildAndDeploy("usr", "psw", "url");

    verify(view, times(1)).showABuildIsAlreadyRunning();
    verify(notificationEvent, never()).fire(any(NotificationEvent.class));
    verifyBusyShowHideAnyString(2, 2);
  }
  @Test
  public void testBuildAndDeployCommandFail() {
    doThrow(new RuntimeException())
        .when(assetManagementServiceMock)
        .buildProject(
            anyString(),
            anyString(),
            anyString(),
            anyString(),
            anyString(),
            anyString(),
            anyBoolean());

    presenter.triggerBuildAndDeploy("user", "password", "url");

    verify(notificationEvent, never()).fire(any(NotificationEvent.class));
    verify(view, times(1)).showUnexpectedErrorPopup(anyString());

    verifyBusyShowHideAnyString(1, 1);
  }
  @Test
  public void testBuildAndDeployCommand() {
    presenter.triggerBuildAndDeploy("user", "password", "url");

    verify(notificationEvent)
        .fire(
            argThat(
                new ArgumentMatcher<NotificationEvent>() {
                  @Override
                  public boolean matches(final Object argument) {
                    final NotificationEvent event = (NotificationEvent) argument;
                    final String notification = event.getNotification();
                    final NotificationEvent.NotificationType type = event.getType();

                    return notification.equals(
                            ProjectEditorResources.CONSTANTS.BuildProcessStarted())
                        && type.equals(NotificationEvent.NotificationType.SUCCESS);
                  }
                }));

    verify(notificationEvent, times(1)).fire(any(NotificationEvent.class));
    verifyBusyShowHideAnyString(1, 1);
  }