CreateCustomRunnerAction extends AbstractRunnerActions { @Override public void actionPerformed(ActionEvent e) { runnerManagerPresenter.setActive(); tabContainer.showTab(locale.runnerTabTemplates()); createSimpleEnvironment(); } @Inject  CreateCustomRunnerAction(RunnerLocalizationConstant locale,
                                    AppContext appContext,
                                    RunnerResources resources,
                                    RunnerManagerPresenter runnerManagerPresenter,
                                    NotificationManager notificationManager,
                                    GetProjectEnvironmentsAction getProjectEnvironmentsAction,
                                    AsyncCallbackBuilder<ItemReference> asyncCallbackBuilder,
                                    ProjectServiceClient projectService,
                                    TemplatesPresenter templatesPresenter,
                                    @LeftPanel TabContainer tabContainer); @Override void actionPerformed(ActionEvent e);  }
@Test public void actionShouldBePerformed() throws Exception { action.actionPerformed(actionEvent); verify(runnerManagerPresenter).setActive(); verify(locale).runnerTabTemplates(); }
@Test public void environmentShouldNotBeCreatedIfCurrentProjectIsNull() throws Exception { when(appContext.getCurrentProject()).thenReturn(null); action.actionPerformed(actionEvent); verify(runnerManagerPresenter).setActive(); verify(locale).runnerTabTemplates(); verify(projectService, never()).createFolder(anyString(), (AsyncRequestCallback<ItemReference>)any()); }
@Test public void environmentShouldBeCreated() throws Exception { action.actionPerformed(actionEvent); verify(runnerManagerPresenter).setActive(); verify(locale).runnerTabTemplates(); verify(asyncCallbackBuilder).unmarshaller(ItemReference.class); verify(asyncCallbackBuilder).success(successCallbackArgumentCaptor.capture()); successCallbackArgumentCaptor.getValue().onSuccess(itemReference1); verify(projectService).createFolder(anyString(), eq(asyncRequestCallback)); verify(projectDescriptor, times(2)).getPath(); verify(asyncCallbackBuilder, times(2)).unmarshaller(ItemReference.class); verify(asyncCallbackBuilder, times(2)).success(successCallbackArgumentCaptor.capture()); successCallbackArgumentCaptor.getValue().onSuccess(itemReference1); verify(getProjectEnvironmentsAction).perform(); }
@Test public void notificationMessageShouldBeShowedIfParentFolderDoesNotCreate() throws Exception { action.actionPerformed(actionEvent); verify(runnerManagerPresenter).setActive(); verify(locale).runnerTabTemplates(); verify(asyncCallbackBuilder).unmarshaller(ItemReference.class); verify(asyncCallbackBuilder).failure(failureCallbackArgumentCaptor.capture()); failureCallbackArgumentCaptor.getValue().onFailure(exception); verify(notificationManager).showError(TEXT); }
@Test public void environmentDoesNotCreatedIfDockerFileNotCrested() throws Exception { action.actionPerformed(actionEvent); verify(runnerManagerPresenter).setActive(); verify(locale).runnerTabTemplates(); verify(asyncCallbackBuilder).unmarshaller(ItemReference.class); verify(asyncCallbackBuilder).success(successCallbackArgumentCaptor.capture()); successCallbackArgumentCaptor.getValue().onSuccess(itemReference1); verify(projectService).createFolder(anyString(), eq(asyncRequestCallback)); verify(projectDescriptor, times(2)).getPath(); verify(asyncCallbackBuilder, times(2)).unmarshaller(ItemReference.class); verify(asyncCallbackBuilder, times(2)).failure(failureCallbackArgumentCaptor.capture()); failureCallbackArgumentCaptor.getValue().onFailure(exception); verify(getProjectEnvironmentsAction, never()).perform(); }