Search in sources :

Example 6 with JUnitConfiguration

use of com.intellij.execution.junit.JUnitConfiguration in project intellij-community by JetBrains.

the class BaseRunConfigurationActionTest method testRunTestMethodName.

public void testRunTestMethodName() {
    JUnitConfiguration configuration = new JUnitConfiguration(null, getProject(), JUnitConfigurationType.getInstance().getConfigurationFactories()[0]);
    JUnitConfiguration.Data data = configuration.getPersistentData();
    data.MAIN_CLASS_NAME = "com.comp.ATestClass";
    configuration.setGeneratedName();
    checkSuggestedName("ATestClass", configuration);
    configuration.setName("Other name");
    configuration.setNameChangedByUser(true);
    checkSuggestedName("Other name", configuration);
    data.METHOD_NAME = "testSmth";
    data.TEST_OBJECT = JUnitConfiguration.TEST_METHOD;
    configuration.setGeneratedName();
    checkSuggestedName("testSmth()", configuration);
    data.METHOD_NAME = "123456789012345678900";
    configuration.setGeneratedName();
    checkSuggestedName("123456789012345678...()", configuration);
}
Also used : JUnitConfiguration(com.intellij.execution.junit.JUnitConfiguration)

Example 7 with JUnitConfiguration

use of com.intellij.execution.junit.JUnitConfiguration in project android by JetBrains.

the class AndroidTestsPattern method getClassFilter.

@Override
protected TestClassFilter getClassFilter(JUnitConfiguration.Data data) throws CantRunException {
    TestClassFilter classFilter = super.getClassFilter(data);
    JUnitConfiguration configuration = getConfiguration();
    Module[] modules = configuration instanceof AndroidJUnitConfiguration ? ((AndroidJUnitConfiguration) configuration).getModulesToCompile() : configuration.getModules();
    for (Module module : modules) {
        TestArtifactSearchScopes testArtifactSearchScopes = TestArtifactSearchScopes.get(module);
        if (testArtifactSearchScopes != null) {
            classFilter = classFilter.intersectionWith(testArtifactSearchScopes.getAndroidTestExcludeScope());
        }
    }
    return classFilter;
}
Also used : TestArtifactSearchScopes(com.android.tools.idea.testartifacts.scopes.TestArtifactSearchScopes) JUnitConfiguration(com.intellij.execution.junit.JUnitConfiguration) Module(com.intellij.openapi.module.Module) TestClassFilter(com.intellij.execution.junit.TestClassFilter)

Example 8 with JUnitConfiguration

use of com.intellij.execution.junit.JUnitConfiguration in project intellij-community by JetBrains.

the class BaseConfigurationTestCase method createJUnitConfiguration.

protected JUnitConfiguration createJUnitConfiguration(@NotNull PsiElement psiElement, @NotNull Class<? extends AbstractJavaTestConfigurationProducer> producerClass, @NotNull MapDataContext dataContext) {
    ConfigurationContext context = createContext(psiElement, dataContext);
    RunConfigurationProducer producer = RunConfigurationProducer.getInstance(producerClass);
    assert producer != null;
    ConfigurationFromContext fromContext = producer.createConfigurationFromContext(context);
    assertNotNull(fromContext);
    return (JUnitConfiguration) fromContext.getConfiguration();
}
Also used : ConfigurationContext(com.intellij.execution.actions.ConfigurationContext) RunConfigurationProducer(com.intellij.execution.actions.RunConfigurationProducer) ConfigurationFromContext(com.intellij.execution.actions.ConfigurationFromContext) JUnitConfiguration(com.intellij.execution.junit.JUnitConfiguration)

Example 9 with JUnitConfiguration

use of com.intellij.execution.junit.JUnitConfiguration in project intellij-community by JetBrains.

the class ConfigurationRefactoringsTest method testRenameJUnitContainingPackage.

public void testRenameJUnitContainingPackage() throws IOException {
    PsiClass psiClass = mySource.createClass("ATest", TEST_CODE);
    assertNotNull(psiClass);
    JUnitConfiguration configuration = createConfiguration(psiClass);
    PsiPackage psiPackage = mySource.createPackage("pkg");
    move(psiClass, "pkg");
    checkClassName("pkg.ATest", configuration);
    rename(psiPackage, "newPkg");
    checkClassName("newPkg.ATest", configuration);
    psiPackage = mySource.findPackage("newPkg");
    mySource.createPackage("pkg2");
    move(psiPackage, "pkg2");
    checkClassName("pkg2.newPkg.ATest", configuration);
}
Also used : JUnitConfiguration(com.intellij.execution.junit.JUnitConfiguration)

Example 10 with JUnitConfiguration

use of com.intellij.execution.junit.JUnitConfiguration in project intellij-community by JetBrains.

the class ConfigurationRefactoringsTest method createJUnitConfiguration.

@Override
protected JUnitConfiguration createJUnitConfiguration(@NotNull PsiElement psiElement, @NotNull Class<? extends AbstractJavaTestConfigurationProducer> producerClass, @NotNull MapDataContext dataContext) {
    final JUnitConfiguration configuration = super.createJUnitConfiguration(psiElement, producerClass, dataContext);
    RunManagerEx.getInstanceEx(myProject).setTemporaryConfiguration(new RunnerAndConfigurationSettingsImpl(null, configuration, false));
    return configuration;
}
Also used : JUnitConfiguration(com.intellij.execution.junit.JUnitConfiguration) RunnerAndConfigurationSettingsImpl(com.intellij.execution.impl.RunnerAndConfigurationSettingsImpl)

Aggregations

JUnitConfiguration (com.intellij.execution.junit.JUnitConfiguration)13 Module (com.intellij.openapi.module.Module)4 RunnerAndConfigurationSettingsImpl (com.intellij.execution.impl.RunnerAndConfigurationSettingsImpl)3 TestArtifactSearchScopes (com.android.tools.idea.testartifacts.scopes.TestArtifactSearchScopes)2 Executor (com.intellij.execution.Executor)2 TestClassFilter (com.intellij.execution.junit.TestClassFilter)2 TestObject (com.intellij.execution.junit.TestObject)2 ExecutionEnvironment (com.intellij.execution.runners.ExecutionEnvironment)2 VisibleForTesting (com.android.annotations.VisibleForTesting)1 Location (com.intellij.execution.Location)1 RunnerAndConfigurationSettings (com.intellij.execution.RunnerAndConfigurationSettings)1 ConfigurationContext (com.intellij.execution.actions.ConfigurationContext)1 ConfigurationFromContext (com.intellij.execution.actions.ConfigurationFromContext)1 RunConfigurationProducer (com.intellij.execution.actions.RunConfigurationProducer)1 GeneralCommandLine (com.intellij.execution.configurations.GeneralCommandLine)1 JavaParameters (com.intellij.execution.configurations.JavaParameters)1 RunConfiguration (com.intellij.execution.configurations.RunConfiguration)1 DefaultRunExecutor (com.intellij.execution.executors.DefaultRunExecutor)1 JUnitConfigurationType (com.intellij.execution.junit.JUnitConfigurationType)1 PatternConfigurationProducer (com.intellij.execution.junit.PatternConfigurationProducer)1