PropertiesEnvironmentPanel extends PropertiesPanelPresenter { @Override public void onSwitcherChanged(boolean isOn) { if (isOn) { templatesContainer.setDefaultEnvironment(environment); } else { templatesContainer.setDefaultEnvironment(null); chooseRunnerAction.setEmptyDefaultRunner(); } } @AssistedInject  PropertiesEnvironmentPanel(final PropertiesPanelView view,
                                      DtoFactory dtoFactory,
                                      @Named("DefaultEditorProvider") EditorProvider editorProvider,
                                      @NotNull final FileTypeRegistry fileTypeRegistry,
                                      final DockerFileFactory dockerFileFactory,
                                      final ProjectServiceClient projectService,
                                      EventBus eventBus,
                                      AppContext appContext,
                                      ChooseRunnerAction chooseRunnerAction,
                                      DialogFactory dialogFactory,
                                      RunnerLocalizationConstant locale,
                                      GetProjectEnvironmentsAction projectEnvironmentsAction,
                                      NotificationManager notificationManager,
                                      DtoUnmarshallerFactory unmarshallerFactory,
                                      AsyncCallbackBuilder<ItemReference> asyncCallbackBuilder,
                                      AsyncCallbackBuilder<List<ItemReference>> asyncArrayCallbackBuilder,
                                      AsyncCallbackBuilder<Void> voidAsyncCallbackBuilder,
                                      AsyncCallbackBuilder<ProjectDescriptor> asyncDescriptorCallbackBuilder,
                                      TemplatesContainer templatesContainer,
                                      EditorAgent editorAgent,
                                      @Assisted @NotNull final Environment environment); @Override void onCopyButtonClicked(); @Override void onConfigurationChanged(); @Override void onSaveButtonClicked(); @Override void onDeleteButtonClicked(); @Override void onCancelButtonClicked(); @Override void update(@NotNull Environment environment); @Override void onSwitcherChanged(boolean isOn); @Override void addListener(@NotNull RemovePanelListener listener); static final String ENVIRONMENT_ID_PREFIX; }
@Test public void switcherShouldBeOn() throws Exception { when(environment.getScope()).thenReturn(SYSTEM); presenter.onSwitcherChanged(true); verify(templatesContainer).setDefaultEnvironment(environment); }
@Test public void switcherShouldBeOff() throws Exception { when(environment.getScope()).thenReturn(SYSTEM); presenter.onSwitcherChanged(false); verify(templatesContainer).setDefaultEnvironment(null); verify(chooseRunnerAction).setEmptyDefaultRunner(); }
@Test public void switcherShouldNotBeChanged() throws Exception { presenter.onSwitcherChanged(true); verify(templatesContainer).setDefaultEnvironment(environment); }