void () { String in = """ import org.junit.Test; class Help { private String s = "hello"; @Test public void testThisThing(){ System.out.println(); System.out.println(); System.out.println(); s = null; } }"""; String what = """ class 'Class { '_FieldType '_FieldName; @'_Annotation '_MethodType '_MethodName() { '_Statement*; '_FieldName = null; } }"""; String by = """ class $Class$ { $FieldType$ $FieldName$; @$Annotation$ $MethodType$ $MethodName$() { $Statement$; } }"""; assertEquals(""" import org.junit.Test; class Help { private String s="hello"; @Test public void testThisThing() { System.out.println(); System.out.println(); System.out.println(); } }""", replace(in, what, by, true)); }