StringUtils { public static String join(List<String> list, String separator) { if (list == null || list.size() == 0) { return ""; } StringBuilder sb = new StringBuilder(); sb.append(list.get(0)); for (int i = 1; i < list.size(); i++) { sb.append(separator).append(list.get(i)); } return sb.toString(); } private  StringUtils(); static String join(List<String> list, String separator); static String convertToUUIDString(String value);  }
@Test public void whenInputIsStringListShouldJoinStrings() { List<String> list = Arrays.asList("a", "b", "c"); String result = StringUtils.join(list, ";"); assertThat(result, is("a;b;c")); }
@Test public void whenSeparatorInputIsIncompleteShouldJoinStrings() { List<String> list = Arrays.asList("a", "b", ""); String result = StringUtils.join(list, ","); assertThat(result, is("a,b,")); }
@Test public void whenInputIsNullShouldReturnEmptyString() { String result = StringUtils.join(null, ";"); assertThat(result, is("")); }