### Question:
StringUtil { public static String format(final String msg, final Object... params) { Assertion.check().isNotNull(msg); if (params == null || params.length == 0) { return msg; } final StringBuilder newMsg = new StringBuilder(msg); replace(newMsg, "''", "'"); replace(newMsg, "'", "''"); replace(newMsg, "\\{", "'{'"); replace(newMsg, "\\}", "'}'"); return MessageFormat.format(newMsg.toString(), params); } private  StringUtil(); static boolean isBlank(final String strValue); static String first2LowerCase(final String strValue); static String first2UpperCase(final String strValue); static String constToLowerCamelCase(final String str); static String constToUpperCamelCase(final String str); static String camelToConstCase(final String str); static String camelToSnakeCase(final String str); static boolean isUpperCamelCase(final String testString); static boolean isLowerCamelCase(final String testString); static boolean isSimpleLetterOrDigit(final char c); static String replace(final String str, final String oldStr, final String newStr); static void replace(final StringBuilder str, final String oldStr, final String newStr); static String format(final String msg, final Object... params);  }### Answer:
@Test public void testformat() { assertEquals("bonjour le monde", StringUtil.format("bonjour le monde")); assertEquals("bonjour le monde", StringUtil.format("bonjour {0} monde", "le")); assertEquals("bonjour le monde", StringUtil.format("bonjour {0} {1}", "le", "monde")); assertEquals("bonjour 'le' monde", StringUtil.format("bonjour ''{0}'' monde", "le")); assertEquals("bonjour 'le' monde", StringUtil.format("bonjour '{0}' monde", "le")); assertEquals("bonjour 'le' monde", StringUtil.format("bonjour ''{0}' monde", "le")); }
@Test public void testformatWithNull() { Assertions.assertThrows(NullPointerException.class, () -> StringUtil.format(null)); }
@Test public void testformatWithError() { Assertions.assertThrows(Exception.class, () -> StringUtil.format("bonjour {0 monde", "le")); }