mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
detect consistently junit 5 in scope (IDEA-162858)
This commit is contained in:
@@ -86,9 +86,7 @@ public class TestClassFilter implements ClassFilter.ClassFilterWithScope {
|
||||
final PsiClass testCase = ApplicationManager.getApplication().runReadAction(new Computable<PsiClass>() {
|
||||
@Override
|
||||
public PsiClass compute() {
|
||||
if (JUnitUtil.isJUnit5(module != null ? GlobalSearchScope.moduleRuntimeScope(module, true)
|
||||
: sourceScope.getLibrariesScope(),
|
||||
sourceScope.getProject())) {
|
||||
if (TestObject.isJUnit5(module, sourceScope, sourceScope.getProject())) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
|
||||
@@ -159,8 +159,7 @@ public abstract class TestObject extends JavaTestFrameworkRunnableState<JUnitCon
|
||||
|
||||
final Project project = getConfiguration().getProject();
|
||||
final SourceScope sourceScope = getSourceScope();
|
||||
final GlobalSearchScope scope = sourceScope != null ? sourceScope.getLibrariesScope() : GlobalSearchScope.allScope(project);
|
||||
if (JUnitUtil.isJUnit5(scope, project)) {
|
||||
if (isJUnit5(getConfiguration().getConfigurationModule().getModule(), sourceScope, project)) {
|
||||
javaParameters.getProgramParametersList().add(JUnitStarter.JUNIT5_PARAMETER);
|
||||
javaParameters.getClassPath().add(PathUtil.getJarPathForClass(JUnit5IdeaTestRunner.class));
|
||||
|
||||
@@ -181,6 +180,12 @@ public abstract class TestObject extends JavaTestFrameworkRunnableState<JUnitCon
|
||||
return javaParameters;
|
||||
}
|
||||
|
||||
public static boolean isJUnit5(@Nullable Module module, @Nullable SourceScope sourceScope, Project project) {
|
||||
return JUnitUtil.isJUnit5(module != null ? GlobalSearchScope.moduleRuntimeScope(module, true)
|
||||
: sourceScope != null ? sourceScope.getLibrariesScope() : GlobalSearchScope.allScope(project),
|
||||
project);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected OSProcessHandler createHandler(Executor executor) throws ExecutionException {
|
||||
appendForkInfo(executor);
|
||||
|
||||
@@ -62,8 +62,9 @@ public class TestPackage extends TestObject {
|
||||
@Override
|
||||
protected void search() {
|
||||
myClasses.clear();
|
||||
SourceScope sourceScope = getSourceScope();
|
||||
if (sourceScope != null && !ReadAction.compute(() -> JUnitUtil.isJUnit5(sourceScope.getLibrariesScope(), myProject))) {
|
||||
final SourceScope sourceScope = getSourceScope();
|
||||
final Module module = getConfiguration().getConfigurationModule().getModule();
|
||||
if (sourceScope != null && !ReadAction.compute(() -> isJUnit5(module, sourceScope, myProject))) {
|
||||
try {
|
||||
final TestClassFilter classFilter = getClassFilter(data);
|
||||
LOG.assertTrue(classFilter.getBase() != null);
|
||||
@@ -102,7 +103,7 @@ public class TestPackage extends TestObject {
|
||||
try {
|
||||
dumbService.setAlternativeResolveEnabled(true);
|
||||
final SourceScope sourceScope = data.getScope().getSourceScope(getConfiguration());
|
||||
if (sourceScope == null || !JUnitUtil.isJUnit5(sourceScope.getLibrariesScope(), project)) { //check for junit 5
|
||||
if (sourceScope == null || !isJUnit5(getConfiguration().getConfigurationModule().getModule(), sourceScope, project)) { //check for junit 5
|
||||
getClassFilter(data);//check if junit 4 found
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user