void () { Config config = GenerateToStringContext.getConfig(); config.setEnableMethods(true); try { doTest(""" class Foobar extends Foo { private int bar; <caret>\s } class Foo { private int foo; public int getFoo() { return foo; } } """, """ class Foobar extends Foo { private int bar; @Override public String toString() { return "Foobar{" + "foo=" + getFoo() + ", bar=" + bar + '}'; } } class Foo { private int foo; public int getFoo() { return foo; } } """, ReplacePolicy.getInstance()); } finally { config.setEnableMethods(false); } }