mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
fix junit5 parameter passed
This commit is contained in:
@@ -53,7 +53,7 @@ class TestClass extends TestObject {
|
||||
final PsiClass psiClass = JavaExecutionUtil.findMainClass(project, getConfiguration().getPersistentData().getMainClassName(), globalSearchScope);
|
||||
if (psiClass != null) {
|
||||
if (JUnitUtil.isJUnit5TestClass(psiClass, false)) {
|
||||
return JUnitStarter.JUNIT5_RUNNER_NAME;
|
||||
return JUnitStarter.JUNIT5_PARAMETER;
|
||||
}
|
||||
return JUnitStarter.JUNIT4_PARAMETER;
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ class TestMethod extends TestObject {
|
||||
if (psiClass == null) return null;
|
||||
|
||||
if (JUnitUtil.isJUnit5TestClass(psiClass, false)) {
|
||||
return JUnitStarter.JUNIT5_RUNNER_NAME;
|
||||
return JUnitStarter.JUNIT5_PARAMETER;
|
||||
}
|
||||
|
||||
if (JUnitUtil.isJUnit4TestClass(psiClass)) {
|
||||
|
||||
@@ -159,7 +159,7 @@ public abstract class TestObject extends JavaTestFrameworkRunnableState<JUnitCon
|
||||
final SourceScope sourceScope = getSourceScope();
|
||||
GlobalSearchScope globalSearchScope = getScopeForJUnit(getConfiguration().getConfigurationModule().getModule(), sourceScope, project);
|
||||
String preferredRunner = getPreferredRunner(globalSearchScope);
|
||||
if (JUnitStarter.JUNIT5_RUNNER_NAME.equals(preferredRunner)) {
|
||||
if (JUnitStarter.JUNIT5_PARAMETER.equals(preferredRunner)) {
|
||||
//detect junit 5 rt without dependency on junit5_rt module
|
||||
File junit4Rt = new File(PathUtil.getJarPathForClass(JUnit4IdeaTestRunner.class));
|
||||
String junit5Name = junit4Rt.getName().replace("junit", "junit5");
|
||||
@@ -176,6 +176,8 @@ public abstract class TestObject extends JavaTestFrameworkRunnableState<JUnitCon
|
||||
|
||||
fileName.startsWith("junit-platform-") && !hasPackageWithDirectories(psiFacade, "org.junit.platform", globalSearchScope) ||
|
||||
|
||||
fileName.startsWith("junit-platform-engine-") && !hasPackageWithDirectories(psiFacade, "org.junit.platform.engine", globalSearchScope) ||
|
||||
|
||||
fileName.startsWith("junit-jupiter-engine-") && !hasPackageWithDirectories(psiFacade, "org.junit.jupiter.engine", globalSearchScope) &&
|
||||
hasPackageWithDirectories(psiFacade, JUnitUtil.TEST5_PACKAGE_FQN, globalSearchScope)) {
|
||||
classPath.add(file.getAbsolutePath());
|
||||
@@ -200,7 +202,7 @@ public abstract class TestObject extends JavaTestFrameworkRunnableState<JUnitCon
|
||||
|
||||
@Nullable
|
||||
protected String getPreferredRunner(GlobalSearchScope globalSearchScope) {
|
||||
return JUnitUtil.isJUnit5(globalSearchScope, getConfiguration().getProject()) ? JUnitStarter.JUNIT5_RUNNER_NAME : null;
|
||||
return JUnitUtil.isJUnit5(globalSearchScope, getConfiguration().getProject()) ? JUnitStarter.JUNIT5_PARAMETER : null;
|
||||
}
|
||||
|
||||
private static boolean hasPackageWithDirectories(JavaPsiFacade psiFacade,
|
||||
|
||||
Reference in New Issue
Block a user