void () { myFixture.configureByText("Foo.java", """ class Foo { String bar() { String result = "ba<caret>r.xml"; return result; } \s }"""); PsiLanguageInjectionHost injectionHost = myFixture.findElementByText("\"bar.xml\"", PsiLanguageInjectionHost.class); SmartPsiElementPointer<PsiLanguageInjectionHost> hostPtr = SmartPointerManager.createPointer(injectionHost); StoringFixPresenter storedFix = new StoringFixPresenter(); InjectLanguageAction.invokeImpl(getProject(), myFixture.getEditor(), myFixture.getFile(), new FileReferenceInjector(), storedFix); myFixture.checkResult(""" class Foo { String bar() { String result = "bar.xml"; return result; } \s }"""); assertTrue(assertOneElement(getInjectedReferences()) instanceof FileReference); storedFix.process((hostPtr.getElement())); myFixture.checkResult(""" import org.intellij.lang.annotations.Language; class Foo { String bar() { @Language("file-reference") String result = "bar.xml"; return result; } \s }"""); assertTrue(assertOneElement(getInjectedReferences()) instanceof FileReference); UnInjectLanguageAction.invokeImpl(getProject(), myFixture.getEditor(), myFixture.getFile()); assertNull(getInjectedReferences()); }