AndroidRunConfigurationEditor extends SettingsEditor<T> implements PanelWithAnchor,
                                                                                                                       ActionListener { @Override protected void applyEditorTo(@NotNull T configuration) { myModuleSelector.applyTo(configuration); if (myDeploymentTargetOptions != null) { myDeploymentTargetOptions.applyTo(configuration); } configuration.CLEAR_LOGCAT = myClearLogCheckBox.isSelected(); configuration.SHOW_LOGCAT_AUTOMATICALLY = myShowLogcatCheckBox.isSelected(); configuration.SKIP_NOOP_APK_INSTALLATIONS = mySkipNoOpApkInstallation.isSelected(); configuration.FORCE_STOP_RUNNING_APP = myForceStopRunningApplicationCheckBox.isSelected(); myConfigurationSpecificEditor.applyTo(configuration); if (myAndroidDebuggerPanel != null) { myAndroidDebuggerPanel.applyTo(configuration.getAndroidDebuggerContext()); } myAndroidProfilersPanel.applyTo(configuration.getProfilerState()); } AndroidRunConfigurationEditor(Project project,
                                       Predicate<AndroidFacet> libraryProjectValidator,
                                       T config,
                                       boolean showLogcatCheckbox,
                                       Function<ConfigurationModuleSelector, ConfigurationSpecificEditor<T>> configurationSpecificEditorFactory); @Override JComponent getAnchor(); @Override void setAnchor(JComponent anchor); ConfigurationModuleSelector getModuleSelector(); @Override void actionPerformed(ActionEvent e);  }
@Test public void applyEditorTo() { AndroidDebuggerContext androidDebuggerContext = Mockito.mock(AndroidDebuggerContext.class); DeployTargetProvider provider = new CloudTestMatrixTargetProvider(); List<DeployTargetProvider> providers = Arrays.asList(new DeviceAndSnapshotComboBoxTargetProvider(), provider); AndroidTestRunConfiguration configuration1 = Mockito.mock(AndroidTestRunConfiguration.class); Mockito.when(configuration1.getAndroidDebuggerContext()).thenReturn(androidDebuggerContext); Mockito.when(configuration1.getApplicableDeployTargetProviders()).thenReturn(providers); Mockito.when(configuration1.getProfilerState()).thenReturn(new ProfilerState()); @SuppressWarnings("unchecked") ConfigurationSpecificEditor<AndroidTestRunConfiguration> configurationSpecificEditor = Mockito.mock(ConfigurationSpecificEditor.class); Mockito.when(configurationSpecificEditor.getComponent()).thenReturn(new JLabel()); AndroidRunConfigurationEditor<AndroidTestRunConfiguration> androidRunConfigurationEditor = new AndroidRunConfigurationEditor<>( myRule.getProject(), facet -> false, configuration1, true, moduleSelector -> configurationSpecificEditor); DeployTargetContext deployTargetContext = new DeployTargetContext(providers); AndroidTestRunConfiguration configuration2 = Mockito.mock(AndroidTestRunConfiguration.class); Mockito.when(configuration2.getDeployTargetContext()).thenReturn(deployTargetContext); Mockito.when(configuration2.getProfilerState()).thenReturn(new ProfilerState()); androidRunConfigurationEditor.getDeploymentTargetOptions().getTargetComboBox().setSelectedItem(provider); androidRunConfigurationEditor.applyEditorTo(configuration2); assertEquals(TargetSelectionMode.FIREBASE_DEVICE_MATRIX, deployTargetContext.getTargetSelectionMode()); }