void () { @Language("JAVA") @SuppressWarnings("ALL") String fileText = "interface PackContainer {\n" + " void foo();\n" + "}\n" + "interface PsiPackage extends PackContainer {}\n" + "class PsiPackageBase implements PackContainer {\n" + " public void foo() {}\n" + "}\n" + "class PsiPackageImpl extends PsiPackageBase implements PsiPackage {}\n" + "\n" + "class Foo {\n" + " class Bar {\n" + " void bar(PsiPackage i) {\n" + " i.fo<caret>o();\n" + " }\n" + " }\n" + "}"; PsiFile file = myFixture.addFileToProject("Foo.java", fileText); myFixture.configureFromExistingVirtualFile(file.getVirtualFile()); final PsiElement[] impls = getTargets(file); assertEquals(1, impls.length); final PsiElement method = impls[0]; assertTrue(method instanceof PsiMethod); final PsiClass aClass = ((PsiMethod)method).getContainingClass(); assertNotNull(aClass); assertEquals("PsiPackageBase", aClass.getName()); }