void () { String in = """ class A { void m() { new Object(); } }"""; String what = "'_expr;"; String by = "$expr$.toString();"; assertEquals("too many semicolons", """ class A { void m() { new Object().toString(); } }""", replace(in, what, by, true)); }