use of com.intellij.execution.junit.JUnitConfigurationType in project intellij-community by JetBrains.
the class ConfigurationRefactoringsTest method testRenameBadTestClass.
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());
}
use of com.intellij.execution.junit.JUnitConfigurationType in project android by JetBrains.
the class AndroidStudioInitializer method disableIdeaJUnitConfigurations.
// JUnit original Extension JUnitConfigurationType is disabled so it can be replaced by its child class AndroidJUnitConfigurationType
private static void disableIdeaJUnitConfigurations() {
// First we unregister the ConfigurationProducers, and after the ConfigurationType
ExtensionPoint<RunConfigurationProducer> configurationProducerExtensionPoint = Extensions.getRootArea().getExtensionPoint(RunConfigurationProducer.EP_NAME);
for (RunConfigurationProducer runConfigurationProducer : configurationProducerExtensionPoint.getExtensions()) {
if (runConfigurationProducer instanceof JUnitConfigurationProducer && !(runConfigurationProducer instanceof AndroidJUnitConfigurationProducer)) {
// In AndroidStudio these ConfigurationProducer s are replaced
configurationProducerExtensionPoint.unregisterExtension(runConfigurationProducer);
}
}
ExtensionPoint<ConfigurationType> configurationTypeExtensionPoint = Extensions.getRootArea().getExtensionPoint(ConfigurationType.CONFIGURATION_TYPE_EP);
for (ConfigurationType configurationType : configurationTypeExtensionPoint.getExtensions()) {
if (configurationType instanceof JUnitConfigurationType && !(configurationType instanceof AndroidJUnitConfigurationType)) {
// In Android Studio the user is forced to use AndroidJUnitConfigurationType instead of JUnitConfigurationType
configurationTypeExtensionPoint.unregisterExtension(configurationType);
}
}
// We hide actions registered by the JUnit plugin and instead we use those registered in android-junit.xml
hideAction("excludeFromSuite");
hideAction("AddToISuite");
}
use of com.intellij.execution.junit.JUnitConfigurationType in project android by JetBrains.
the class AndroidJUnitConfigurationTypeTest method testJUnitConfigurationTypeGetInstance.
// Since JUnitConfigurationType is disabled in AndroidStudioInitializer, and AndroidJUnitConfigurationType
// is registered as child, it should be returned when getInstance() of the parent is called
public void testJUnitConfigurationTypeGetInstance() {
JUnitConfigurationType configurationType = JUnitConfigurationType.getInstance();
assertInstanceOf(configurationType, AndroidJUnitConfigurationType.class);
}
Aggregations