本文整理汇总了Java中com.intellij.execution.junit.JUnitConfiguration类的典型用法代码示例。如果您正苦于以下问题:Java JUnitConfiguration类的具体用法?Java JUnitConfiguration怎么用?Java JUnitConfiguration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JUnitConfiguration类属于com.intellij.execution.junit包,在下文中一共展示了JUnitConfiguration类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testRenameBadTestClass
import com.intellij.execution.junit.JUnitConfiguration; //导入依赖的package包/类
public void testRenameBadTestClass() throws IOException {
PsiClass psiClass = mySource.createClass("NotATest", NOT_A_TEST);
assertNotNull(psiClass);
JUnitConfigurationType instance = JUnitConfigurationType.getInstance();
assertNotNull(instance);
JUnitConfiguration configuration = new JUnitConfiguration("notATest", myProject, instance.getConfigurationFactories()[0]);
configuration.setMainClass(psiClass);
configuration.setModule(configuration.getValidModules().iterator().next());
checkConfigurationException("NotATest isn't test class", configuration);
RunManagerEx.getInstanceEx(myProject).setTemporaryConfiguration(new RunnerAndConfigurationSettingsImpl(null, configuration, false));
rename(psiClass, "NotATest2");
JUnitConfiguration.Data data = configuration.getPersistentData();
assertEquals("NotATest2", data.getMainClassName());
data.METHOD_NAME = "test";
data.TEST_OBJECT = JUnitConfiguration.TEST_METHOD;
checkConfigurationException("Test method 'test' doesn't exist", configuration);
rename(psiClass.findMethodsByName("test", false)[0], "test2");
assertEquals("NotATest2", data.getMainClassName());
assertEquals("test2", data.getMethodName());
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:ConfigurationRefactoringsTest.java
示例2: testRefactorOtherClass
import com.intellij.execution.junit.JUnitConfiguration; //导入依赖的package包/类
public void testRefactorOtherClass() throws IOException {
PsiClass psiClass = mySource.createClass("ATest", TEST_CODE);
assertNotNull(psiClass);
JUnitConfiguration configuration = createConfiguration(psiClass);
psiClass = mySource.createClass("Application", APPLICATION_CODE);
assertNotNull(psiClass);
rename(psiClass, "NewName");
checkClassName("ATest", configuration);
mySource.createPackage("pkg");
psiClass = mySource.findClass("NewName");
assertNotNull(psiClass);
move(psiClass, "pkg");
checkClassName("ATest", configuration);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:ConfigurationRefactoringsTest.java
示例3: testRunTestMethodName
import com.intellij.execution.junit.JUnitConfiguration; //导入依赖的package包/类
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 = "12345678901234567890";
configuration.setGeneratedName();
checkSuggestedName("123456789012345678...()", configuration);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:BaseRunConfigurationActionTest.java
示例4: getRunProfile
import com.intellij.execution.junit.JUnitConfiguration; //导入依赖的package包/类
@Override
protected MyRunProfile getRunProfile(@NotNull ExecutionEnvironment environment) {
//noinspection ConstantConditions
final JUnitConfiguration configuration = (JUnitConfiguration)myConsoleProperties.getConfiguration();
final TestMethods testMethods = new TestMethods(configuration, environment, getFailedTests(configuration.getProject()));
return new MyRunProfile(configuration) {
@Override
@NotNull
public Module[] getModules() {
return testMethods.getModulesToCompile();
}
@Override
public RunProfileState getState(@NotNull Executor executor, @NotNull ExecutionEnvironment env) {
testMethods.clear();
return testMethods;
}
};
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:RerunFailedTestsAction.java
示例5: initScope
import com.intellij.execution.junit.JUnitConfiguration; //导入依赖的package包/类
@NotNull
@Override
protected GlobalSearchScope initScope() {
final JUnitConfiguration.Data persistentData = getConfiguration().getPersistentData();
final String testObject = persistentData.TEST_OBJECT;
//ignore invisible setting
if (JUnitConfiguration.TEST_CATEGORY.equals(testObject) ||
JUnitConfiguration.TEST_PATTERN.equals(testObject) ||
JUnitConfiguration.TEST_PACKAGE.equals(testObject)) {
final SourceScope sourceScope = persistentData.getScope().getSourceScope(getConfiguration());
return sourceScope != null ? sourceScope.getGlobalSearchScope() : GlobalSearchScope.allScope(getProject());
}
else {
return super.initScope();
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:JUnitConsoleProperties.java
示例6: applyEditorTo
import com.intellij.execution.junit.JUnitConfiguration; //导入依赖的package包/类
public void applyEditorTo(final JUnitConfiguration configuration) {
myModel.apply(getModuleSelector().getModule(), configuration);
applyHelpersTo(configuration);
final JUnitConfiguration.Data data = configuration.getPersistentData();
if (myWholeProjectScope.isSelected()) {
data.setScope(TestSearchScope.WHOLE_PROJECT);
}
else if (mySingleModuleScope.isSelected()) {
data.setScope(TestSearchScope.SINGLE_MODULE);
}
else if (myModuleWDScope.isSelected()) {
data.setScope(TestSearchScope.MODULE_WITH_DEPENDENCIES);
}
configuration.setAlternativeJrePath(myJrePathEditor.getJrePathOrName());
configuration.setAlternativeJrePathEnabled(myJrePathEditor.isAlternativeJreSelected());
myCommonJavaParameters.applyTo(configuration);
configuration.setForkMode((String)myForkCb.getSelectedItem());
configuration.setRepeatMode((String)myRepeatCb.getSelectedItem());
try {
configuration.setRepeatCount(Integer.parseInt(myRepeatCountField.getText()));
}
catch (NumberFormatException e) {
configuration.setRepeatCount(1);
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:JUnitConfigurable.java
示例7: resetEditorFrom
import com.intellij.execution.junit.JUnitConfiguration; //导入依赖的package包/类
public void resetEditorFrom(final JUnitConfiguration configuration) {
myModel.reset(configuration);
myCommonJavaParameters.reset(configuration);
getModuleSelector().reset(configuration);
final TestSearchScope scope = configuration.getPersistentData().getScope();
if (scope == TestSearchScope.SINGLE_MODULE) {
mySingleModuleScope.setSelected(true);
}
else if (scope == TestSearchScope.MODULE_WITH_DEPENDENCIES) {
myModuleWDScope.setSelected(true);
}
else {
myWholeProjectScope.setSelected(true);
}
myJrePathEditor
.setPathOrName(configuration.getAlternativeJrePath(), configuration.isAlternativeJrePathEnabled());
myForkCb.setSelectedItem(configuration.getForkMode());
final int count = configuration.getRepeatCount();
myRepeatCountField.setText(String.valueOf(count));
myRepeatCountField.setEnabled(count > 1);
myRepeatCb.setSelectedItem(configuration.getRepeatMode());
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:JUnitConfigurable.java
示例8: getFilter
import com.intellij.execution.junit.JUnitConfiguration; //导入依赖的package包/类
protected ClassFilter.ClassFilterWithScope getFilter() throws NoFilterException {
final ConfigurationModuleSelector moduleSelector = getModuleSelector();
final Module module = moduleSelector.getModule();
if (module == null) {
throw NoFilterException.moduleDoesntExist(moduleSelector);
}
final ClassFilter.ClassFilterWithScope classFilter;
try {
final JUnitConfiguration configurationCopy =
new JUnitConfiguration(ExecutionBundle.message("default.junit.configuration.name"), getProject(),
JUnitConfigurationType.getInstance().getConfigurationFactories()[0]);
applyEditorTo(configurationCopy);
classFilter = TestClassFilter
.create(configurationCopy.getTestObject().getSourceScope(), configurationCopy.getConfigurationModule().getModule());
}
catch (JUnitUtil.NoJUnitException e) {
throw NoFilterException.noJUnitInModule(module);
}
return classFilter;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:JUnitConfigurable.java
示例9: configure
import com.intellij.execution.junit.JUnitConfiguration; //导入依赖的package包/类
@Override
public void configure(JUnitConfiguration jUnitConfiguration, PitestConfiguration configuration) {
JUnitConfiguration.Data data = jUnitConfiguration.getPersistentData();
String targetTests = "";
String targetClasses = "";
String dirName = data.getDirName();
VirtualFile dir = LocalFileSystem.getInstance().findFileByPath(FileUtil.toSystemIndependentName(dirName));
if (dir != null) {
PsiDirectory directory = PsiManager.getInstance(jUnitConfiguration.getProject()).findDirectory(dir);
if (directory != null) {
PsiPackage psiPackage = JavaDirectoryService.getInstance().getPackage(directory);
if (psiPackage != null) {
String packageName = psiPackage.getQualifiedName();
targetTests = isEmpty(packageName) ? "" : packageName + ANY_IN_PACKAGE_PATTERN;
targetClasses = targetTests;
}
}
}
configure(configuration, targetTests, targetClasses);
}
开发者ID:artspb,项目名称:idea-pitest,代码行数:21,代码来源:DirectoryBasedConfigurator.java
示例10: assertAndRunPantsMake
import com.intellij.execution.junit.JUnitConfiguration; //导入依赖的package包/类
protected void assertAndRunPantsMake(JUnitConfiguration runConfiguration) {
RunManager runManager = RunManager.getInstance(myProject);
assertTrue(runManager instanceof RunManagerImpl);
RunManagerImpl runManagerImpl = (RunManagerImpl) runManager;
RunnerAndConfigurationSettings runnerAndConfigurationSettings =
runManagerImpl.createConfiguration(runConfiguration, JUnitConfigurationType.getInstance().getConfigurationFactories()[0]);
runManagerImpl.addConfiguration(runnerAndConfigurationSettings, false);
// Make sure PantsMake is the one and only task before JUnit run.
List<BeforeRunTask<?>> beforeRunTaskList = runManagerImpl.getBeforeRunTasks(runConfiguration);
assertEquals(1, beforeRunTaskList.size());
BeforeRunTask task = beforeRunTaskList.iterator().next();
assertEquals(PantsMakeBeforeRun.ID, task.getProviderId());
/*
* Manually invoke BeforeRunTask as {@link ExecutionManager#compileAndRun} launches another task asynchronously,
* and there is no way to catch that.
*/
BeforeRunTaskProvider provider = BeforeRunTaskProvider.getProvider(myProject, task.getProviderId());
assertNotNull(String.format("Cannot find BeforeRunTaskProvider for id='%s'", task.getProviderId()), provider);
assertTrue(provider.executeTask(null, runConfiguration, null, task));
}
开发者ID:pantsbuild,项目名称:intellij-pants-plugin,代码行数:25,代码来源:PantsIntegrationTestCase.java
示例11: testRenameBadTestClass
import com.intellij.execution.junit.JUnitConfiguration; //导入依赖的package包/类
public void testRenameBadTestClass() throws IOException {
PsiClass psiClass = mySource.createClass("NotATest", NOT_A_TEST);
JUnitConfiguration configuration = new JUnitConfiguration("notATest", myProject, JUnitConfigurationType.getInstance().getConfigurationFactories()[0]);
configuration.setMainClass(psiClass);
configuration.setModule(configuration.getValidModules().iterator().next());
checkConfigurationException("NotATest isn't test class", configuration);
RunManagerEx.getInstanceEx(myProject).setTemporaryConfiguration(new RunnerAndConfigurationSettingsImpl(null, configuration, false));
rename(psiClass, "NotATest2");
JUnitConfiguration.Data data = configuration.getPersistentData();
assertEquals("NotATest2", data.getMainClassName());
data.METHOD_NAME = "test";
data.TEST_OBJECT = JUnitConfiguration.TEST_METHOD;
checkConfigurationException("Test method 'test' doesn't exist", configuration);
rename(psiClass.findMethodsByName("test", false)[0], "test2");
assertEquals("NotATest2", data.getMainClassName());
assertEquals("test2", data.getMethodName());
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:22,代码来源:ConfigurationRefactoringsTest.java
示例12: getRunProfile
import com.intellij.execution.junit.JUnitConfiguration; //导入依赖的package包/类
@Override
public MyRunProfile getRunProfile() {
final JUnitConfiguration configuration = (JUnitConfiguration)getModel().getProperties().getConfiguration();
final TestMethods testMethods = new TestMethods(configuration.getProject(), configuration, myEnvironment, getFailedTests(configuration.getProject()));
return new MyRunProfile(configuration) {
@NotNull
public Module[] getModules() {
return testMethods.getModulesToCompile();
}
public RunProfileState getState(@NotNull Executor executor, @NotNull ExecutionEnvironment env) throws ExecutionException {
testMethods.clear();
return testMethods;
}
@Override
public void clear() {
testMethods.clear();
super.clear();
}
};
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:23,代码来源:RerunFailedTestsAction.java
示例13: applyEditorTo
import com.intellij.execution.junit.JUnitConfiguration; //导入依赖的package包/类
public void applyEditorTo(final JUnitConfiguration configuration) {
myModel.apply(getModuleSelector().getModule(), configuration);
applyHelpersTo(configuration);
final JUnitConfiguration.Data data = configuration.getPersistentData();
if (myWholeProjectScope.isSelected()) {
data.setScope(TestSearchScope.WHOLE_PROJECT);
}
else if (mySingleModuleScope.isSelected()) {
data.setScope(TestSearchScope.SINGLE_MODULE);
}
else if (myModuleWDScope.isSelected()) {
data.setScope(TestSearchScope.MODULE_WITH_DEPENDENCIES);
}
configuration.setAlternativeJrePath(myAlternativeJREPanel.getPath());
configuration.setAlternativeJrePathEnabled(myAlternativeJREPanel.isPathEnabled());
myCommonJavaParameters.applyTo(configuration);
configuration.setForkMode((String)myForkCb.getSelectedItem());
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:20,代码来源:JUnitConfigurable.java
示例14: resetEditorFrom
import com.intellij.execution.junit.JUnitConfiguration; //导入依赖的package包/类
public void resetEditorFrom(final JUnitConfiguration configuration) {
myModel.reset(configuration);
myCommonJavaParameters.reset(configuration);
getModuleSelector().reset(configuration);
final TestSearchScope scope = configuration.getPersistentData().getScope();
if (scope == TestSearchScope.SINGLE_MODULE) {
mySingleModuleScope.setSelected(true);
}
else if (scope == TestSearchScope.MODULE_WITH_DEPENDENCIES) {
myModuleWDScope.setSelected(true);
}
else {
myWholeProjectScope.setSelected(true);
}
myAlternativeJREPanel.init(configuration.getAlternativeJrePath(), configuration.isAlternativeJrePathEnabled());
myForkCb.setSelectedItem(configuration.getForkMode());
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:18,代码来源:JUnitConfigurable.java
示例15: showMavenToolWindow
import com.intellij.execution.junit.JUnitConfiguration; //导入依赖的package包/类
public void showMavenToolWindow() {
ConfigurationType configurationType = new JUnitConfigurationType();
ConfigurationFactory configurationFactory = new ConfigurationFactoryEx<JUnitConfiguration>(configurationType) {
@NotNull
@Override
public RunConfiguration createTemplateConfiguration(@NotNull Project project) {
return new JUnitConfiguration(project.getName(), project, this);
}
};
JUnitConfiguration configuration = new JUnitConfiguration(project.getName(), project, configurationFactory);
Executor executor = new DefaultRunExecutor();
ProcessHandler processHandler = new NopProcessHandler();
TestConsoleProperties consoleProperties = new MavenTestConsoleProperties(mavenProject, project, executor, configuration, processHandler);
BaseTestsOutputConsoleView consoleView;
try {
consoleView = SMTestRunnerConnectionUtil.createAndAttachConsole(TOOL_WINDOW_ID, processHandler, consoleProperties);
} catch (ExecutionException e) {
throw new RuntimeException(e);
}
showInToolWindow(consoleView, mavenProject.getFinalName());
processHandler.startNotify();
}
开发者ID:destin,项目名称:maven-test-support-plugin,代码行数:23,代码来源:MavenToolWindow.java
示例16: isApplicableFor
import com.intellij.execution.junit.JUnitConfiguration; //导入依赖的package包/类
@Override
protected boolean isApplicableFor(@NotNull final RunConfigurationBase configuration) {
if (!(configuration instanceof JUnitConfiguration)) {
return false;
}
final Project project = configuration.getProject();
final HybrisProjectSettings settings = HybrisProjectSettingsComponent.getInstance(project).getState();
return settings.isHybrisProject();
}
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:10,代码来源:HybrisJUnitExtension.java
示例17: testRenameJUnitPackage
import com.intellij.execution.junit.JUnitConfiguration; //导入依赖的package包/类
public void testRenameJUnitPackage() throws IOException {
PsiPackage psiPackage = mySource.createPackage("pkg");
JUnitConfiguration configuration = createJUnitConfiguration(psiPackage, AllInPackageConfigurationProducer.class, new MapDataContext());
rename(psiPackage, "pkg2");
checkPackage("pkg2", configuration);
PsiPackage outer = mySource.createPackage("outerPkg");
move(JavaPsiFacade.getInstance(myProject).findPackage("pkg2"), outer.getQualifiedName());
checkPackage("outerPkg.pkg2", configuration);
rename(outer, "outer2");
checkPackage("outer2.pkg2", configuration);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:ConfigurationRefactoringsTest.java
示例18: testRenameJUnitContainingPackage
import com.intellij.execution.junit.JUnitConfiguration; //导入依赖的package包/类
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);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:ConfigurationRefactoringsTest.java
示例19: testRefactorTestMethod
import com.intellij.execution.junit.JUnitConfiguration; //导入依赖的package包/类
public void testRefactorTestMethod() throws IOException {
PsiClass psiClass = mySource.createClass("ATest", TEST_CODE);
assertNotNull(psiClass);
PsiMethod testMethod = psiClass.findMethodsByName("test", false)[0];
JUnitConfiguration configuration = createConfiguration(testMethod);
rename(testMethod, "test1");
checkMethodName("test1", configuration);
checkClassName("ATest", configuration);
assertEquals("ATest.test1", configuration.getName());
move(psiClass, "pkg");
checkClassName("pkg.ATest", configuration);
psiClass = configuration.getConfigurationModule().findClass(configuration.getPersistentData().getMainClassName());
rename(psiClass, "TestClassName");
assertEquals("TestClassName.test1", configuration.getName());
psiClass = configuration.getConfigurationModule().findClass(configuration.getPersistentData().getMainClassName());
PsiClass otherTest = mySource.createClass("ATest", TEST_CODE);
HashSet<PsiMember> members = new HashSet<PsiMember>();
assertNotNull(psiClass);
members.add(psiClass.findMethodsByName("test1", false)[0]);
moveMembers(otherTest, members);
psiClass = configuration.getConfigurationModule().findClass(configuration.getPersistentData().getMainClassName());
checkMethodName("test1", configuration);
checkClassName("ATest", configuration);
assertEquals("ATest.test1", configuration.getName());
assertNotNull(psiClass);
PsiMethod otherMethod = psiClass.findMethodsByName("otherMethod", false)[0];
rename(otherMethod, "newName");
checkMethodName("test1", configuration);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:32,代码来源:ConfigurationRefactoringsTest.java
示例20: checkConfigurationException
import com.intellij.execution.junit.JUnitConfiguration; //导入依赖的package包/类
private static void checkConfigurationException(String expectedExceptionMessage, JUnitConfiguration configuration) {
try {
configuration.checkConfiguration();
}
catch (RuntimeConfigurationException e) {
assertEquals(expectedExceptionMessage, e.getLocalizedMessage());
return;
}
assertTrue("ConfigurationException expected", false);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:ConfigurationRefactoringsTest.java
注:本文中的com.intellij.execution.junit.JUnitConfiguration类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论