Search in sources :

Example 1 with JUnitConfigurable

use of com.intellij.execution.junit2.configuration.JUnitConfigurable in project intellij-community by JetBrains.

the class JUnitConfiguration method getConfigurationEditor.

@Override
@NotNull
public SettingsEditor<? extends RunConfiguration> getConfigurationEditor() {
    SettingsEditorGroup<JUnitConfiguration> group = new SettingsEditorGroup<>();
    group.addEditor(ExecutionBundle.message("run.configuration.configuration.tab.title"), new JUnitConfigurable(getProject()));
    JavaRunConfigurationExtensionManager.getInstance().appendEditors(this, group);
    group.addEditor(ExecutionBundle.message("logs.tab.title"), new LogConfigurationPanel<>());
    return group;
}
Also used : SettingsEditorGroup(com.intellij.openapi.options.SettingsEditorGroup) JUnitConfigurable(com.intellij.execution.junit2.configuration.JUnitConfigurable) NotNull(org.jetbrains.annotations.NotNull)

Example 2 with JUnitConfigurable

use of com.intellij.execution.junit2.configuration.JUnitConfigurable in project android by JetBrains.

the class AndroidJUnitConfiguration method getConfigurationEditor.

@Override
@NotNull
public SettingsEditor<? extends RunConfiguration> getConfigurationEditor() {
    SettingsEditorGroup<AndroidJUnitConfiguration> group = new SettingsEditorGroup<>();
    group.addEditor(ExecutionBundle.message("run.configuration.configuration.tab.title"), new JUnitConfigurable(getProject()));
    JavaRunConfigurationExtensionManager.getInstance().appendEditors(this, group);
    group.addEditor(ExecutionBundle.message("logs.tab.title"), new LogConfigurationPanel<>());
    return group;
}
Also used : SettingsEditorGroup(com.intellij.openapi.options.SettingsEditorGroup) JUnitConfigurable(com.intellij.execution.junit2.configuration.JUnitConfigurable) NotNull(org.jetbrains.annotations.NotNull)

Example 3 with JUnitConfigurable

use of com.intellij.execution.junit2.configuration.JUnitConfigurable in project intellij-community by JetBrains.

the class ConfigurationsTest method testModulesSelector.

public void testModulesSelector() throws ConfigurationException {
    if (PlatformTestUtil.COVERAGE_ENABLED_BUILD)
        return;
    Module module1 = getModule1();
    Module module2 = getModule2();
    JUnitConfigurable editor = new JUnitConfigurable(myProject);
    try {
        JUnitConfiguration configuration = createConfiguration(findTestA(module2));
        // To get all the watchers installed.
        editor.getComponent();
        Configurable configurable = new RunConfigurationConfigurableAdapter(editor, configuration);
        JComboBox comboBox = editor.getModulesComponent();
        configurable.reset();
        assertFalse(configurable.isModified());
        assertEquals(module2.getName(), ((Module) comboBox.getSelectedItem()).getName());
        //no module
        assertEquals(ModuleManager.getInstance(myProject).getModules().length + 1, comboBox.getModel().getSize());
        comboBox.setSelectedItem(module1);
        assertTrue(configurable.isModified());
        configurable.apply();
        assertFalse(configurable.isModified());
        assertEquals(Collections.singleton(module1), ContainerUtilRt.newHashSet(configuration.getModules()));
    } finally {
        Disposer.dispose(editor);
    }
}
Also used : JUnitConfigurable(com.intellij.execution.junit2.configuration.JUnitConfigurable) Configurable(com.intellij.openapi.options.Configurable) ApplicationConfigurable(com.intellij.execution.application.ApplicationConfigurable) Module(com.intellij.openapi.module.Module) JUnitConfigurable(com.intellij.execution.junit2.configuration.JUnitConfigurable)

Example 4 with JUnitConfigurable

use of com.intellij.execution.junit2.configuration.JUnitConfigurable in project intellij-community by JetBrains.

the class ConfigurationsTest method testEditJUnitConfiguration.

public void testEditJUnitConfiguration() throws ConfigurationException {
    if (PlatformTestUtil.COVERAGE_ENABLED_BUILD)
        return;
    PsiClass testA = findTestA(getModule2());
    JUnitConfiguration configuration = createConfiguration(testA);
    JUnitConfigurable editor = new JUnitConfigurable(myProject);
    try {
        Configurable configurable = new RunConfigurationConfigurableAdapter(editor, configuration);
        configurable.reset();
        final EditorTextFieldWithBrowseButton component = ((LabeledComponent<EditorTextFieldWithBrowseButton>) editor.getTestLocation(JUnitConfigurationModel.CLASS)).getComponent();
        assertEquals(testA.getQualifiedName(), component.getText());
        PsiClass otherTest = findClass(getModule2(), "test2.Test2");
        component.setText(otherTest.getQualifiedName());
        configurable.apply();
        assertEquals(otherTest.getName(), configuration.getName());
        String specialName = "My name";
        configuration.setName(specialName);
        configuration.setNameChangedByUser(true);
        configurable.reset();
        component.setText(testA.getQualifiedName());
        configurable.apply();
        assertEquals(specialName, configuration.getName());
    } finally {
        Disposer.dispose(editor);
    }
}
Also used : EditorTextFieldWithBrowseButton(com.intellij.ui.EditorTextFieldWithBrowseButton) JUnitConfigurable(com.intellij.execution.junit2.configuration.JUnitConfigurable) Configurable(com.intellij.openapi.options.Configurable) ApplicationConfigurable(com.intellij.execution.application.ApplicationConfigurable) JUnitConfigurable(com.intellij.execution.junit2.configuration.JUnitConfigurable) LabeledComponent(com.intellij.openapi.ui.LabeledComponent)

Aggregations

JUnitConfigurable (com.intellij.execution.junit2.configuration.JUnitConfigurable)4 ApplicationConfigurable (com.intellij.execution.application.ApplicationConfigurable)2 Configurable (com.intellij.openapi.options.Configurable)2 SettingsEditorGroup (com.intellij.openapi.options.SettingsEditorGroup)2 NotNull (org.jetbrains.annotations.NotNull)2 Module (com.intellij.openapi.module.Module)1 LabeledComponent (com.intellij.openapi.ui.LabeledComponent)1 EditorTextFieldWithBrowseButton (com.intellij.ui.EditorTextFieldWithBrowseButton)1