ConsoleContainerPresenter implements ConsoleContainer,
                                                  ConsoleContainerView.ActionDelegate,
                                                  SelectionManager.SelectionChangeListener { @Override public void onSelectionChanged(@NotNull Selection selection) { if (Selection.ENVIRONMENT.equals(selection)) { return; } Runner runner = selectionManager.getRunner(); if (runner == null) { return; } selectedConsole = getConsoleOrCreate(runner); view.showWidget(selectedConsole); } @Inject  ConsoleContainerPresenter(ConsoleContainerView view, WidgetFactory widgetFactory, SelectionManager selectionManager); @Override void print(@NotNull Runner runner, @NotNull String message); @Override void printInfo(@NotNull Runner runner, @NotNull String message); @Override void printError(@NotNull Runner runner, @NotNull String message); @Override void printWarn(@NotNull Runner runner, @NotNull String message); @Override void reset(); @Override void onSelectionChanged(@NotNull Selection selection); @NotNull @Override IsWidget getView(); @Override void setVisible(boolean visible); @Override void go(AcceptsOneWidget container); @Override void onScrollBottomClicked(); @Override void onWrapTextClicked(); @Override void onCleanClicked(); @Override void deleteConsoleByRunner(@NotNull Runner runner); @Override void setVisibleNoRunnerLabel(boolean visible);  }
@Test public void selectionShouldBeOnChangedWhenSelectionIsEnvironment() { presenter.onSelectionChanged(ENVIRONMENT); verify(selectionManager, never()).getRunner(); verify(view, never()).showWidget(any(IsWidget.class)); }
@Test public void selectionShouldBeOnChangedWhenSelectionIsRunnerIsNull() { presenter.onSelectionChanged(RUNNER); verify(selectionManager).getRunner(); verify(view, never()).showWidget(any(IsWidget.class)); }
@Test public void selectionShouldBeOnChangedWhenSelectionIsRunner() { when(selectionManager.getRunner()).thenReturn(runner); presenter.onSelectionChanged(RUNNER); verify(selectionManager).getRunner(); verify(view).showWidget(console); }