void () { String source = "abstract class MyClass implements java.util.List {\n private String a, b;\n}"; String search = "class 'Name implements java.util.List {\n '_ClassContent*\n}"; String replace = "class $Name$ {\n $ClassContent$\n}"; String expectedResult = "abstract class MyClass {\n private String a, b;\n}"; assertEquals(expectedResult, replace(source, search, replace, true)); }