void () { @Language("JAVA") @SuppressWarnings("ALL") String fileText = "interface A {\n" + " void save();\n" + "}\n" + "interface B extends A {\n" + " void foo();\n" + "}\n" + "class X implements B {\n" + " public void foo() { }\n" + " public void save(){}\n" + "}\n" + "class Y implements A {\n" + " public void save(){}\n" + "}\n" + "class App {\n" + " private B b;\n" + " private void some() {\n" + " b.sa<caret>ve();\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("X", aClass.getName()); }