AggregationDistinctQueryResult extends DistinctQueryResult { @Override public String getColumnLabel(final int columnIndex) throws SQLException { if (metaData.isAggregationDistinctColumnIndex(columnIndex)) { return metaData.getAggregationDistinctColumnLabel(columnIndex); } String columnLabel = getQueryResultMetaData().getColumnLabel(columnIndex); if (null != columnLabel) { return columnLabel; } throw new SQLException("Column index out of range", "9999"); } private  AggregationDistinctQueryResult(final QueryResultMetaData queryResultMetaData, final Iterator<QueryRow> resultData, final AggregationDistinctQueryMetaData distinctQueryMetaData);  AggregationDistinctQueryResult(final Collection<QueryResult> queryResults, final List<AggregationDistinctSelectItem> aggregationDistinctSelectItems); @Override List<DistinctQueryResult> divide(); @Override Object getValue(final int columnIndex, final Class<?> type); @Override Object getValue(final String columnLabel, final Class<?> type); @Override Object getCalendarValue(final int columnIndex, final Class<?> type, final Calendar calendar); @Override Object getCalendarValue(final String columnLabel, final Class<?> type, final Calendar calendar); @Override InputStream getInputStream(final int columnIndex, final String type); @Override InputStream getInputStream(final String columnLabel, final String type); @Override boolean wasNull(); @Override String getColumnLabel(final int columnIndex);  }
@Test public void assertGetColumnLabel() throws SQLException { assertThat(aggregationDistinctQueryResult.getColumnLabel(3), is("a")); assertThat(aggregationDistinctQueryResult.getColumnLabel(1), is("order_id")); }
@Test(expected = SQLException.class) public void assertGetColumnLabelWithException() throws SQLException { assertThat(aggregationDistinctQueryResult.getColumnLabel(6), is("order_id")); }