void () { String s1 = """ public class X { /** * zzz */ void f() { } }"""; String s2 = """ class 'c { /** * zzz */ void f(){} }"""; String s3 = """ class $c$ { /** * ppp */ void f(){} }"""; String expectedResult = """ public class X { /** * ppp */ void f(){} }"""; assertEquals("Not preserving comment if it is present", expectedResult, replace(s1, s2, s3, true)); }