I\'m looking for something to achieve the following:
String s = \"hello {}!\"; s = generate(s, new Object[]{ \"world\" }); assertEquals(s, \"hello world!\");
If you can tolerate a different kind of placeholder (i.e. %s in place of {}) you can use String.format method for that:
%s
{}
String s = "hello %s!"; s = String.format(s, "world" ); assertEquals(s, "hello world!"); // true