void (final String qName) { final AtomicReference<PsiClass> foundFile = new AtomicReference<>(); final GlobalSearchScope searchScope = GlobalSearchScope.allScope(getProject()); final Processor<PsiClass> processor = file -> { foundFile.set(file); return false; }; try { StubIndex.getInstance() .processElements(JavaStubIndexKeys.CLASS_FQN, qName, getProject(), searchScope, PsiClass.class, aClass -> { StubIndex.getInstance() .processElements(JavaStubIndexKeys.CLASS_FQN, qName, getProject(), searchScope, PsiClass.class, processor); return false; }); fail("Should fail with class mismatch"); } catch (AssertionError ignored) { // stub mismatch } //assertTrue(((StubIndexImpl)StubIndex.instance).areAllProblemsProcessedInTheCurrentThread()) // //try { // StubIndex.instance.processElements(JavaStubIndexKeys.CLASS_FQN, qName, project, searchScope, PsiFile.class, processor) // // fail("Unexpected") //} //catch (AssertionError ignored) { // // stub mismatch //} }