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);
}
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;
}
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();
}
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);
}
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;
}
Aggregations