ModelConverterUtils { static void appendDataRows(Iterable<String> data, Collector<Row> collector, final int numFields) { if (data != null) { int index = 0; for (String s : data) { appendStringData(s, collector, numFields, index + 1); index++; } } }    }
@Test public void testAppendDataRows() throws Exception { List<String> stringList = new ArrayList<>(); stringList.add("apple"); stringList.add("banana"); MockCollector collector = new MockCollector(); ModelConverterUtils.appendDataRows(stringList, collector, 2); Row row1 = collector.buffer.get(0); Assert.assertEquals(row1.getArity(), 2); Assert.assertEquals(row1.getField(0), ModelConverterUtils.MAX_NUM_SLICES); Assert.assertEquals(row1.getField(1), "apple"); Row row2 = collector.buffer.get(1); Assert.assertEquals(row2.getArity(), 2); Assert.assertEquals(row2.getField(0), 2 * ModelConverterUtils.MAX_NUM_SLICES); Assert.assertEquals(row2.getField(1), "banana"); }