mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
junit: try to check each class in scope
This commit is contained in:
@@ -1377,6 +1377,9 @@ batch.inspections.process.external.elements.description=When building graph for
|
||||
junit4.search.4.tests.in.classpath=true
|
||||
junit4.search.4.tests.in.classpath.description=Search for tests in the module output
|
||||
|
||||
junit4.search.4.tests.all.in.scope=true
|
||||
junit4.search.4.tests.all.in.scope.description=Check each class in scope if it's test, then include as test
|
||||
|
||||
duplicates.inspection.only.extractable=false
|
||||
duplicates.inspection.only.extractable.description=Highlight duplicate code only if it can be extracted into a method
|
||||
|
||||
|
||||
@@ -81,7 +81,19 @@ public class TestPackage extends TestObject {
|
||||
final TestClassFilter classFilter = getClassFilter(data);
|
||||
LOG.assertTrue(classFilter.getBase() != null);
|
||||
long start = System.currentTimeMillis();
|
||||
if (Registry.is("junit4.search.4.tests.in.classpath", false)) {
|
||||
if (Registry.is("junit4.search.4.tests.all.in.scope", true)) {
|
||||
String packageName = getPackageName(data);
|
||||
PsiPackage aPackage = JavaPsiFacade.getInstance(myProject).findPackage(packageName);
|
||||
PsiClass[] classes = aPackage == null
|
||||
? PsiClass.EMPTY_ARRAY
|
||||
: ReadAction.compute(() ->
|
||||
aPackage.getClasses(GlobalSearchScope.projectScope(myProject)
|
||||
.intersectWith(classFilter.getScope())));
|
||||
Arrays.stream(classes)
|
||||
.filter(aClass -> ReadAction.compute(() -> classFilter.isAccepted(aClass)))
|
||||
.forEach(myClasses::add);
|
||||
}
|
||||
else if (Registry.is("junit4.search.4.tests.in.classpath", false)) {
|
||||
String packageName = getPackageName(data);
|
||||
String[] classNames = TestClassCollector.collectClassFQNames(packageName, getRootPath(), getConfiguration(), TestPackage::createPredicate);
|
||||
PsiManager manager = PsiManager.getInstance(myProject);
|
||||
|
||||
Reference in New Issue
Block a user