StringUtil { public static String commaAnd(String... words) { switch (words.length) { case 0: return ""; case 1: return words[0]; case 2: return words[0] + " and " + words[1]; default: return joinWordsWithAnd(words); } } private  StringUtil(); static String commaAnd(String... words);  }
@Test void commaAnd0() { assertEquals("", StringUtil.commaAnd()); }
@Test void commaAnd1() { assertEquals("A", StringUtil.commaAnd("A")); }
@Test void commaAnd2() { assertEquals("A and B", StringUtil.commaAnd("A", "B")); }
@Test void commaAnd3() { assertEquals("A, B and C", StringUtil.commaAnd("A", "B", "C")); }