void () { String s1 = """ package com.www.xxx.yyy; import javax.swing.*; public class Test { public static void main(String[] args) { if (1==1) JOptionPane.showMessageDialog(null, "MESSAGE"); } }"""; String s2 = "JOptionPane.'_showDialog(null, '_msg);"; String s3 = "//FIXME provide a parent frame\n" + "JOptionPane.$showDialog$(null, $msg$);"; String expectedResult = """ package com.www.xxx.yyy; import javax.swing.*; public class Test { public static void main(String[] args) { if (1==1) //FIXME provide a parent frame JOptionPane.showMessageDialog(null, "MESSAGE"); } }"""; assertEquals("adding comment to statement inside the if body", expectedResult, replace(s1, s2, s3)); String s4 = "myButton.setText(\"Ok\");"; String s5 = "'_Instance.'_MethodCall:[regex( setText )]('_Parameter*:[regex( \"Ok\" )]);"; String s6 = "$Instance$.$MethodCall$(\"OK\");"; String expectedResult2 = "myButton.setText(\"OK\");"; assertEquals("adding comment to statement inside the if body", expectedResult2, replace(s4, s5, s6)); }