void () { String in = """ class A { String s; void setS(String s) { System.out.println(this.s); this.s = s; } }"""; String what = "System.out.println('_a);"; String by = "System.out.println(\"$a$\" + $a$);"; assertEquals("don't drop this", """ class A { String s; void setS(String s) { System.out.println("this.s" + this.s); this.s = s; } }""", replace(in, what, by)); }