void () { String input = """ import org.intellij.lang.annotations.Language; class Scratch { @Language("jvm-method-name") @interface MethodName {} public @interface ComponentProperties { // ... various other attributes ... @MethodName String waitForMethod() default ""; } public class MainComponent { @ComponentProperties(waitForMethod = "<error descr="Cannot resolve symbol 'waitForB'">waitForB<caret></error>") public BlueComponent blueComponent; private void waitForBlueComponent() { // ... } } \s interface BlueComponent {} }"""; myFixture.configureByText("MethodName.java", input); myFixture.enableInspections(new InjectedReferencesInspection()); myFixture.checkHighlighting(); myFixture.completeBasic(); String result = """ import org.intellij.lang.annotations.Language; class Scratch { @Language("jvm-method-name") @interface MethodName {} public @interface ComponentProperties { // ... various other attributes ... @MethodName String waitForMethod() default ""; } public class MainComponent { @ComponentProperties(waitForMethod = "waitForBlueComponent<caret>") public BlueComponent blueComponent; private void waitForBlueComponent() { // ... } } \s interface BlueComponent {} }"""; myFixture.checkResult(result); PsiElement element = myFixture.getFile().findElementAt(myFixture.getEditor().getCaretModel().getOffset()); assertTrue(element instanceof PsiJavaToken); element = element.getParent(); assertTrue(element instanceof PsiLiteralExpression); PsiReference[] refs = element.getReferences(); assertEquals(1, refs.length); PsiElement target = refs[0].resolve(); assertTrue(target instanceof PsiMethod); assertEquals("waitForBlueComponent", ((PsiMethod)target).getName()); }