void () { VirtualFile packDir = createChildDirectory(mySrcDir1, "pack"); final VirtualFile file1 = createChildData(packDir, "A.java"); final VirtualFile file2 = createChildData(mySrcDir2, "B.java"); ApplicationManager.getApplication().runWriteAction(() -> { setFileText(file1, "package pack; class A{ class Inner{ class InnerInner }}"); setFileText(file2, "class B{ }"); }); PsiDocumentManager.getInstance(myProject).commitAllDocuments(); JavaFileManager fileManager = JavaFileManager.getInstance(myProject); PsiClass aClass1 = fileManager.findClass("pack.A", GlobalSearchScope.allScope(myProject)); assertNotNull(aClass1); assertEquals("pack.A", aClass1.getQualifiedName()); PsiClass aClass2 = fileManager.findClass("B", GlobalSearchScope.allScope(myProject)); assertNotNull(aClass2); assertEquals("B", aClass2.getQualifiedName()); PsiClass aClass3 = fileManager.findClass("pack.A.Inner", GlobalSearchScope.allScope(myProject)); assertNotNull(aClass3); assertEquals("pack.A.Inner", aClass3.getQualifiedName()); PsiClass aClass4 = fileManager.findClass("pack.A.Inner.InnerInner", GlobalSearchScope.allScope(myProject)); assertNotNull(aClass4); assertEquals("pack.A.Inner.InnerInner", aClass4.getQualifiedName()); }