void () { final PsiClass baseClass = myJavaFacade.findClass("pack.Gen", GlobalSearchScope.moduleScope(myModule)); assertNotNull(baseClass); final PsiMethod method = baseClass.getMethods()[0]; PsiReference[] references = MethodReferencesSearch.search(method, GlobalSearchScope.projectScope(getProject()), true).toArray(PsiReference.EMPTY_ARRAY); assertEquals(1, references.length); PsiClass refClass = PsiTreeUtil.getParentOfType(references[0].getElement(), PsiClass.class); assertEquals("X2", refClass.getName()); }