RowCollector implements Collector<Row> { public RowCollector() { this(null); } RowCollector();  RowCollector(List<Row> rows); List<Row> getRows(); @Override void collect(Row row); @Override void close(); void clear();  }
@Test public void testRowCollector() { List<Row> rows = new ArrayList<>(1); RowCollector collector = new RowCollector(rows); collector.collect(Row.of(2)); Assert.assertEquals("test size of RowCollector fail", 1, collector.getRows().size()); Assert.assertEquals("test value of RowCollector fail", 2, collector.getRows().get(0).getField(0)); collector.clear(); Assert.assertEquals("test clear of RowCollector fail", 0, collector.getRows().size()); collector.collect(Row.of(0)); collector.close(); Assert.assertEquals("test close of RowCollector fail", 0, collector.getRows().size()); }