### Question:
ListUtil { public static <T> String generateCommaSeparatedString(List<T> list) { if (list == null || list.isEmpty()) { return ""; } String outList = ""; for (T t : list) { outList += t + ", "; } return outList.substring(0, outList.length() - 2); }  static List<Integer> compare(List<Integer> list1, List<Integer> list2); static List<Integer> compareAndReturnMatches(List<Integer> list1, List<Integer> list2); static String generateCommaSeparatedString(List<T> list);  }### Answer:
@Test public void generateAnIntegerCommaSeparatedList() { List<Integer> actual = new ArrayList<Integer>(); String expected = "0, 1, 2, 3, 4, 5"; for (int i = 0; i <= 5; i++) { actual.add(i); } assertEquals(expected, ListUtil.generateCommaSeparatedString(actual)); }
@Test public void generateAnIntegerCommaSeparatedListWithEmptyList() { List<Integer> list = new ArrayList<Integer>(); assertEquals("", ListUtil.generateCommaSeparatedString(list)); }
@Test public void generateAnIntegerCommaSeparatedListWithNullList() { assertEquals("", ListUtil.generateCommaSeparatedString(null)); }