RunnerManagerPresenter extends BasePresenter implements RunnerManager,
                                                                     RunnerManagerView.ActionDelegate,
                                                                     ProjectActionHandler,
                                                                     SelectionManager.SelectionChangeListener { @Override public void onToggleSplitterClicked(boolean isShowSplitter) { terminalTab.setScopes(isShowSplitter ? EnumSet.allOf(State.class) : EnumSet.of(RUNNERS)); if (isShowSplitter) { panelState.setSplitterState(SPLITTER_ON); view.setLeftPropertiesPanel(leftPropertiesContainer); view.setRightPropertiesPanel(rightPropertiesContainer); } else { panelState.setSplitterState(SPLITTER_OFF); view.setGeneralPropertiesPanel(rightPropertiesContainer); } if (TEMPLATE.equals(state)) { panelState.setState(TEMPLATE); leftTabContainer.showTab(locale.runnerTabTemplates()); if (SPLITTER_OFF.equals(panelState.getSplitterState())) { rightPropertiesContainer.showTab(propertiesTab.getTitle()); } } } @Inject  RunnerManagerPresenter(final RunnerManagerView view,
                                  RunnerActionFactory actionFactory,
                                  ModelsFactory modelsFactory,
                                  AppContext appContext,
                                  DtoFactory dtoFactory,
                                  ChooseRunnerAction chooseRunnerAction,
                                  EventBus eventBus,
                                  final RunnerLocalizationConstant locale,
                                  @LeftPanel TabContainer leftTabContainer,
                                  @LeftPropertiesPanel TabContainer leftPropertiesContainer,
                                  @RightPropertiesPanel TabContainer rightPropertiesContainer,
                                  PanelState panelState,
                                  Provider<TabBuilder> tabBuilderProvider,
                                  final ConsoleContainer consoleContainer,
                                  TerminalContainer terminalContainer,
                                  PropertiesContainer propertiesContainer,
                                  HistoryPanel history,
                                  TemplatesContainer templateContainer,
                                  RunnerCounter runnerCounter,
                                  SelectionManager selectionManager,
                                  TimerFactory timerFactory,
                                  GetSystemEnvironmentsAction getSystemEnvironmentsAction,
                                  RunnerUtil runnerUtil,
                                  @Run ResourcesLockedActionPermit runActionPermit,
                                  @Run ActionDenyAccessDialog runActionDenyAccessDialog); @NotNull RunnerManagerView getView(); void update(@NotNull Runner runner); @Override void onRunButtonClicked(); @Override void onRerunButtonClicked(); @Override void onStopButtonClicked(); @Override void onLogsButtonClicked(); @Override void stopRunner(@NotNull Runner runner); @Override void onMoreInfoBtnMouseOver(); @Override void onToggleSplitterClicked(boolean isShowSplitter); @Override Runner launchRunner(); @NotNull @Override Runner launchRunner(@NotNull RunOptions runOptions); @Override @NotNull Runner launchRunner(@NotNull RunOptions runOptions, @NotNull Scope scope, @NotNull String environmentName); @Override void go(@NotNull AcceptsOneWidget container); void setActive(); @NotNull @Override String getTitle(); @Nullable @Override ImageResource getTitleImage(); @Nullable @Override String getTitleToolTip(); @Override void onProjectReady(@NotNull ProjectActionEvent projectActionEvent); @Override void onProjectClosing(ProjectActionEvent event); @Override void onProjectClosed(@NotNull ProjectActionEvent projectActionEvent); @Override void onProjectOpened(ProjectActionEvent event); @NotNull Runner addRunner(@NotNull ApplicationProcessDescriptor processDescriptor); void addRunnerId(@NotNull Long runnerId); boolean isRunnerExist(@NotNull Long runnerId); @Override void onSelectionChanged(@NotNull Selection selection); static final String TIMER_STUB; }
@Test public void splitterShouldBeShownWhenPanelStateIsHistory() throws Exception { reset(leftPropertiesContainer, view, panelState); presenter.onToggleSplitterClicked(true); verify(terminalTab).setScopes(EnumSet.allOf(State.class)); verify(panelState).setSplitterState(SPLITTER_ON); verify(view).setLeftPropertiesPanel(leftPropertiesContainer); verify(view).setRightPropertiesPanel(rightPropertiesContainer); verify(panelState, never()).setSplitterState(SPLITTER_OFF); verify(view, never()).setGeneralPropertiesPanel(Matchers.<TabContainer>anyObject()); verify(panelState, never()).setState(TEMPLATE); verify(leftTabContainer, never()).showTab(TEMPLATES); }
@Test public void splitterShouldNotBeShownAndPanelStateIsTemplate() throws Exception { verifyTabSelectHandler(tabBuilderTemplate); reset(leftPropertiesContainer, view, panelState); when(panelState.getSplitterState()).thenReturn(SPLITTER_OFF); presenter.onToggleSplitterClicked(false); verify(terminalTab).setScopes(EnumSet.of(RUNNERS)); verify(panelState, never()).setSplitterState(SPLITTER_ON); verify(view, never()).setLeftPropertiesPanel(leftPropertiesContainer); verify(view, never()).setRightPropertiesPanel(rightPropertiesContainer); verify(panelState).setSplitterState(SPLITTER_OFF); verify(view).setGeneralPropertiesPanel(rightPropertiesContainer); verify(panelState).setState(TEMPLATE); verify(leftTabContainer).showTab(TEMPLATES); verify(rightPropertiesContainer).showTab(PROPERTIES); }