mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
test finder: accept potential tests as junit4 doesn't contain features of test until it contains test methods (IDEA-120123)
This commit is contained in:
@@ -101,7 +101,7 @@ public class JavaTestFinder implements TestFinder {
|
||||
for (String eachName : names) {
|
||||
if (pattern.matcher(eachName).matches()) {
|
||||
for (PsiClass eachClass : cache.getClassesByName(eachName, scope)) {
|
||||
if (TestFrameworks.getInstance().isTestClass(eachClass)) {
|
||||
if (TestFrameworks.getInstance().isPotentialTestClass(eachClass)) {
|
||||
classesWithProximities.add(
|
||||
new Pair<PsiClass, Integer>(eachClass, TestFinderHelper.calcTestNameProximity(klassName, eachName)));
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ public abstract class TestFrameworks {
|
||||
}
|
||||
|
||||
public abstract boolean isTestClass(PsiClass psiClass);
|
||||
public abstract boolean isPotentialTestClass(PsiClass psiClass);
|
||||
|
||||
@Nullable
|
||||
public abstract PsiMethod findOrCreateSetUpMethod(PsiClass psiClass);
|
||||
|
||||
@@ -42,6 +42,17 @@ public class TestFrameworksImpl extends TestFrameworks {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPotentialTestClass(PsiClass psiClass) {
|
||||
final TestFramework[] testFrameworks = Extensions.getExtensions(TestFramework.EXTENSION_NAME);
|
||||
for (TestFramework framework : testFrameworks) {
|
||||
if (framework.isPotentialTestClass(psiClass)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public PsiMethod findOrCreateSetUpMethod(final PsiClass psiClass) {
|
||||
|
||||
Reference in New Issue
Block a user