@Test public void testIsDirtyBuildAndInstall() { model.setPOM(mock(POM.class)); // causes isDirty evaluates as true presenter.triggerBuildAndInstall(); 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 testAlreadyRunningBuildAndInstall() { constructProjectScreenPresenter( new CallerMock<BuildService>(buildService), assetManagementCaller()); presenter.onStartup(mock(PlaceRequest.class)); presenter.triggerBuildAndInstall(); presenter.triggerBuildAndInstall(); verify(view, times(1)).showABuildIsAlreadyRunning(); verify(notificationEvent, never()).fire(any(NotificationEvent.class)); verifyBusyShowHideAnyString(2, 2); }
@Test public void testBuildAndInstallCommandFail() { doThrow(new RuntimeException()) .when(assetManagementServiceMock) .buildProject( anyString(), anyString(), anyString(), anyString(), anyString(), anyString(), anyBoolean()); presenter.triggerBuildAndInstall(); verify(notificationEvent, never()).fire(any(NotificationEvent.class)); verify(view, times(1)).showUnexpectedErrorPopup(anyString()); verifyBusyShowHideAnyString(1, 1); }
@Test public void testBuildAndInstallCommand() { presenter.triggerBuildAndInstall(); 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); }