SQLResultSet implements IPentahoResultSet, IPeekable { public Object getValueAt( final int row, final int column ) { if ( nativeResultSet != null ) { try { int curNativeRow = nativeResultSet.getRow(); if ( curNativeRow != ( row + 1 ) ) { if ( curNativeRow == row ) { nativeResultSet.next(); } else { nativeResultSet.absolute( row + 1 ); } } return nativeResultSet.getObject( column + 1 ); } catch ( SQLException ex ) { SQLResultSet.log.error( Messages.getInstance().getErrorString( "SQLResultSet.ERROR_0002_GET_VALUE" ), ex ); throw new IllegalStateException( Messages.getInstance().getErrorString( "SQLResultSet.ERROR_0008_FORWARDED_SQL_MSG" ), ex ); } } 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 testGetValueAt() throws SQLException { Object value = "testObject"; int rowCount = 2; when( nativeResultSet.getObject( anyInt() ) ).thenReturn( value ); when( nativeResultSet.getRow() ).thenReturn( rowCount ).thenReturn( rowCount - 1 ); SQLResultSet resultSet = new SQLResultSet( nativeResultSet, nativeConnection ); assertEquals( value, resultSet.getValueAt( 0, 0 ) ); }
@Test public void testGetValueAtNullResultSet() throws SQLException { SQLResultSet resultSet = new SQLResultSet( null, nativeConnection ); assertNull( resultSet.getValueAt( 0, 0 ) ); }