### Question:
PrimitiveConverters { public static String integerList2cdString(List<Integer> ints) throws ConverterException { StringBuilder sb = new StringBuilder(); String component; int intListSize; int i; if (ints == null) { throw new ConverterException("Could not convert a null Integer list to String"); } intListSize = ints.size(); if (intListSize <= 0) { return sb.toString(); } for (i = 0; i < intListSize - 1; i++) { component = String.format("%d,", ints.get(i)); sb.append(component); } component = String.format("%d",ints.get(intListSize-1)); sb.append(component); return sb.toString(); }  static List<Integer> cdString2IntegerList(String ints); static String integerList2cdString(List<Integer> ints);  }### Answer:
@Test(expected=ConverterException.class) public void shouldThrowExceptionIfListisNull() throws ConverterException{ String resultStr = integerList2cdString(null); }
@Test public void shouldConvert123List2String() throws ConverterException{ String result = integerList2cdString(eil); assertEquals(is,result); }
@Test public void shouldConvert1List2String() throws ConverterException{ String result = integerList2cdString(esil); assertEquals(sis,result); }
@Test public void shouldConvertEmptyList2EmptyString() throws ConverterException{ String result = integerList2cdString(el); assertEquals(e,result); }