void () { String s40 = """ class A { /* special comment*/ private List<String> a = new ArrayList(); static { int a = 1; } }"""; String s41 = """ class '_Class { '_Stuff2* '_FieldType '_FieldName = '_Init?; static { '_Stmt*; } '_Stuff* }"""; String s42 = """ class $Class$ { $Stuff2$ $FieldType$ $FieldName$ = build$FieldName$Map(); private static $FieldType$ build$FieldName$Map() { $FieldType$ $FieldName$ = $Init$; $Stmt$; return $FieldName$; } $Stuff$ }"""; String expectedResult15 = """ class A { \s /* special comment*/ private List<String> a = buildaMap(); private static List<String> buildaMap() { List<String> a = new ArrayList(); int a = 1; return a; } \s }"""; assertEquals("Preserving var modifiers and generic information in type during replacement", expectedResult15, replace(s40, s41, s42, true)); String s46 = "class Foo { int xxx; void foo() { assert false; } void yyy() {}}"; String s47 = "class '_Class { void '_foo:[regex( foo )](); }"; String s48 = "class $Class$ { void $foo$(int a); }"; String expectedResult17 = "class Foo { int xxx; void foo(int a) { assert false; } void yyy() {}}"; assertEquals( "Preserving method bodies", expectedResult17, replace(s46, s47, s48, true) ); }