void () { myFixture.configureByText("Foo.java", """ class Foo { String bar() { String result = "{\\"a<caret>\\" : 1}"; return result; } \s }"""); InjectLanguageAction.invokeImpl(getProject(), myFixture.getEditor(), myFixture.getFile(), Injectable.fromLanguage(Language.findLanguageByID("JSON"))); myFixture.checkResult(""" class Foo { String bar() { String result = "{\\"a\\" : 1}"; return result; } \s }"""); assertInjectedLangAtCaret("JSON"); undo(); assertInjectedLangAtCaret(null); }