ChooseRunnerAction extends AbstractRunnerActions implements CustomComponentAction { @Nullable public Environment selectEnvironment() { if (systemRunners.isEmpty() && projectRunners.isEmpty()) { return null; } String selectedEnvironmentName = dropDownHeaderWidget.getSelectedElementName(); for (Environment environment : projectRunners) { if (environment.getName().equals(selectedEnvironmentName)) { return environment; } } for (Environment environment : systemRunners) { if (environment.getName().equals(selectedEnvironmentName)) { return environment; } } return null; } @Inject  ChooseRunnerAction(RunnerResources resources,
                              RunnerLocalizationConstant locale,
                              AppContext appContext,
                              ActionManager actionManager,
                              DropDownListFactory dropDownListFactory); @Override void actionPerformed(ActionEvent e); @Override Widget createCustomComponent(Presentation presentation); void addSystemRunners(@NotNull List<Environment> systemEnvironments); void addProjectRunners(@NotNull List<Environment> projectEnvironments); @Nullable Environment selectEnvironment(); void selectDefaultRunner(); void setEmptyDefaultRunner();  }
@Test public void EnvironmentShouldNotBeSelectedIfProjectDoesNotHaveAnyEnvironment() throws Exception { action.selectEnvironment(); verify(dropDownHeaderWidget, never()).getSelectedElementName(); }