Utils { static String join(String[] array, String delimiter) { StringBuilder sb = new StringBuilder(); Iterator<String> it = Arrays.asList(array).iterator(); while (it.hasNext()) { sb.append(it.next()); if (!it.hasNext()) { break; } sb.append(delimiter); } return sb.toString(); } private  Utils(); static Properties loadEnvironmentProperties(Map<String, String> env); static void deleteQuietly(Path f);  }
@Test public void should_join_strings() { assertThat(Utils.join(new String[] {}, ",")).isEqualTo(""); assertThat(Utils.join(new String[] {"foo"}, ",")).isEqualTo("foo"); assertThat(Utils.join(new String[] {"foo", "bar"}, ",")).isEqualTo("foo,bar"); }