ResultProcessor { public void write(Iterator<List<ResultElement>> resultIt, Output output) { while (resultIt.hasNext()) { List<ResultElement> row = resultIt.next(); output.addResultItem(convertResultElementsToStrings(row)); } } ResultProcessor(); void write(Iterator<List<ResultElement>> resultIt, Output output);  }
@Test public void nullElements() { List<ResultElement> row = new ArrayList<ResultElement>(); row.add(null); row.add(null); row.add(null); row.add(null); List<List<ResultElement>> table = Arrays.asList(row); MemoryOutput output = new MemoryOutput(); ResultProcessor processor = new ResultProcessor(); processor.write(table.iterator(), output); assertEquals("Every null element should now be an empty string", Arrays.asList("", "", "", ""), output.getResults().get(0)); }