AbstractDataSource implements DataSource, Serializable { public DataSource getRowStatistics(String key) { DataTable statisticsTable = getRowCount() != 0 ? new DataTable(Double.class) : new DataTable(); for (int rowIndex = 0; rowIndex < getRowCount(); rowIndex++) { Record row = getRecord(rowIndex); statisticsTable.add(new Statistics(row).get(key)); } return statisticsTable; } AbstractDataSource();  AbstractDataSource(String name, Class<? extends Comparable<?>>... types);  AbstractDataSource(Class<? extends Comparable<?>>... types);  AbstractDataSource(Column... remainingColumns); Statistics getStatistics(); DataSource getColumnStatistics(String key); DataSource getRowStatistics(String key); void addDataListener(DataListener dataListener); void removeDataListener(DataListener dataListener); Iterator<Comparable<?>> iterator(); @Override Column<?> getColumn(int col); @Override String getName(); @Override Record getRecord(int row); int getColumnCount(); Class<? extends Comparable<?>>[] getColumnTypes(); boolean isColumnNumeric(int columnIndex); Row getRow(int row);  }
@Test public void testRowStatisticsForDataSourceContainsRowForEachRowInDataSource() { int rowCount = 3; source = new StubAbstractDataSource(5, rowCount); DataSource rowStatistics = source.getRowStatistics(Statistics.N); assertThat(rowStatistics.getRowCount(), is(rowCount)); }