void () { String s1 = """ @Nullable (a=String.class) @String class Test { void aaa(String t) { String a = String.valueOf(' '); String2 a2 = String2.valueOf(' '); } }"""; String s2 = "'String:String"; String s2_2 = "String"; String s2_3 = "'String:java\\.lang\\.String"; String s2_4 = "java.lang.String"; String replacement = CommonClassNames.JAVA_UTIL_LIST; String expected = """ @Nullable (a=java.util.List.class) @java.util.List class Test { void aaa(java.util.List t) { java.util.List a = java.util.List.valueOf(' '); String2 a2 = String2.valueOf(' '); } }"""; assertEquals(expected, replace(s1, s2, replacement)); assertEquals(expected, replace(s1, s2_2, replacement)); assertEquals(expected, replace(s1, s2_3, replacement)); assertEquals(expected, replace(s1, s2_4, replacement)); }