void () { @Language("JAVA") String text = """ public class Foo { private final String text; public Foo(String text) { // this.text = text; } public Foo(int i) { } @Override public String to<caret>String() { return "text"; } }"""; myFixture.configureByText("a.java", text); PsiElement element = TargetElementUtil.findTargetElement(myFixture.getEditor(), TargetElementUtil.getInstance().getAllAccepted()); assert element != null; final String newText = ImplementationViewComponent.getNewText(element); assertEquals(""" @Override public String toString() { return "text"; }\ """, newText); }