### Question:
PrimitiveConverters { public static List<Integer> cdString2IntegerList(String ints) throws ConverterException { List<Integer> out = new ArrayList<Integer>(); String format; String msg; Integer currInt; int i; if (ints == null) { throw new ConverterException("ints was null can't convert"); } String[] splitInts = ints.split(","); if (splitInts.length == 0) { msg = String.format("Error \"%s\" yeilded an empty ArrayList"); throw new ConverterException(msg); } if (splitInts[0].trim().equals("")) { return out; } for (i = 0; i < splitInts.length; i++) { try { currInt = Integer.parseInt(splitInts[i].trim()); } catch (NumberFormatException ex) { format = "Could not convert \"%s\" to Integer\n"; msg = String.format(format, splitInts[i]); throw new ConverterException(msg); } out.add(currInt); } return out; }  static List<Integer> cdString2IntegerList(String ints); static String integerList2cdString(List<Integer> ints);  }### Answer:
@Test public void shouldConvert123List() throws ConverterException { List<Integer> resultList = cdString2IntegerList(is); assertTrue(isListIdentical(eil, resultList)); }
@Test public void shouldConvert1List() throws ConverterException { List<Integer> resultList = cdString2IntegerList(sis); assertTrue(isListIdentical(esil, resultList)); }
@Test public void shouldConvertemptyList() throws ConverterException { List<Integer> resultList = cdString2IntegerList(e); assertTrue(isListIdentical(el, resultList)); }
@Test(expected=ConverterException.class) public void shouldThrowExceptionIfIntsIsNull() throws ConverterException{ List<Integer> resultList = cdString2IntegerList(null); }
@Test(expected=ConverterException.class) public void shouldThrowExceptionIfIntsAreBad() throws ConverterException{ List<Integer> resultList = cdString2IntegerList(bis); }