### Question:
StringUtils { public static String arrayFormat(String format, Object[] items) { if (format == null) return ""; StringBuffer builder = new StringBuffer(format.length() + 50); Matcher m = PATTERN.matcher(format); int i = 0; while (m.find()) { m.appendReplacement(builder, ((items != null && i < items.length)) ? callToString(items[i]) : "?" ); i += 1; } m.appendTail(builder); return builder.toString(); }  static String arrayFormat(String format, Object[] items); static Optional<String> cdr(String name, String... sep); static String car(String name, String... sep); static String lastOf(String qualifiedName, String... sep); static String untill(String qualifiedName, String... sep); static String dotToUpperCamelCase(String input); static String dotToDash(String input); static String camelCaseToDash(String input); static boolean isPackageFriendly(String moduleName); static String withoutTypeArgs(String javaTypeString); static String notEmptytrimmed(String param); static Optional<Tuple<String, String>> splitIntoTwo(String mappingString); static int countMatches(String theString, String... sep);  }### Answer:
@Test void testMessageWithNulls() { assertEquals("", arrayFormat("", new Object[]{"a"})); assertEquals("", arrayFormat(null, new Object[]{"a"})); assertEquals("", arrayFormat("{}", new Object[]{""})); assertEquals("?", arrayFormat("{}", null)); assertEquals("null", arrayFormat("{}", new Object[]{null, null})); }
@Test void testMessageWithSomeObjects() { assertEquals("a", arrayFormat("{}", new Object[]{"a"})); assertEquals("1", arrayFormat("{}", new Object[]{1})); assertEquals("1?", arrayFormat("{}{}", new Object[]{1})); assertEquals("12", arrayFormat("{}{}", new Object[]{1,2})); assertEquals("1 2", arrayFormat("{} {}", new Object[]{1,2,3})); assertEquals("abc", arrayFormat("abc", new Object[]{1,2,3})); }
@Test void testMessageWithList() { assertEquals("1,2,3", arrayFormat("{}", new Object[]{ Arrays.asList(1, 2, 3) } )); }