void () { String s1 = "a=a;"; String s2 = "'a"; String s3 = "$b$"; try { replace(s1, s2, s3); fail("Undefined replace variable is not checked"); } catch (MalformedPatternException ignored) { } String s4 = "a=a;"; String s5 = "a=a;"; String s6 = "a=a"; try { replace(s4, s6, s5); fail("Undefined no ; in search"); } catch (UnsupportedPatternException ignored) { } try { replace(s4, "'_Instance.'MethodCall('_Parameter*);", "$Instance$.$MethodCall$($Parameter$);"); fail("Method call expression target can't be replaced with statement"); } catch (UnsupportedPatternException ignored) { } }