SQLResultSet implements IPentahoResultSet, IPeekable { public Object[] next() { if ( peekRow != null ) { Object[] row = peekRow; peekRow = null; return row; } try { int columns = nativeResultSet.getMetaData().getColumnCount(); if ( nativeResultSet.next() ) { Object[] currentRow = new Object[columns]; for ( int column = 0; column < columns; column++ ) { currentRow[column] = nativeResultSet.getObject( column + 1 ); } return currentRow; } } catch ( SQLException e ) { SQLResultSet.log.error( Messages.getInstance().getErrorString( "SQLResultSet.ERROR_0005_NEXT" ), e ); throw new SQLResultSetException( Messages.getInstance().getErrorString( "SQLResultSet.ERROR_0005_NEXT" ), e ); } return null; } SQLResultSet( final ResultSet nativeResultSet, final SQLConnection nativeConnection ); void setMetaData( final IPentahoMetaData metadata ); IPentahoMetaData getMetaData(); Object[] peek(); Object[] next(); void closeConnection(); void close(); void dispose(); boolean isScrollable(); int getColumnCount(); int getRowCount(); Object getValueAt( final int row, final int column ); IPentahoResultSet memoryCopy(); void beforeFirst(); Object[] getDataColumn( final int column ); Object[] getDataRow( final int row );  }
@Test public void testNext() throws SQLException { Object value = "testObject"; when( nativeResultSet.getObject( anyInt() ) ).thenReturn( value ); when( nativeResultSet.next() ).thenReturn( true ); SQLResultSet resultSet = new SQLResultSet( nativeResultSet, nativeConnection ); Object[] objects = resultSet.next(); for ( int i = 0; i < objects.length; i++ ) { assertEquals( value, objects[i] ); } }