### Question:
StaxPoiSheet implements KSheet { @Override public KCell[] getRow( int rownr ) { if ( rownr < 0 || rownr >= numRows ) { throw new ArrayIndexOutOfBoundsException( rownr ); } if ( rownr + 1 < firstRow ) { return new KCell[0]; } if ( rownr > 0 && currentRow == rownr + 1 ) { return currentRowCells; } try { if ( currentRow >= rownr + 1 ) { resetSheetReader(); } while ( sheetReader.hasNext() ) { int event = sheetReader.next(); if ( event == XMLStreamConstants.START_ELEMENT && sheetReader.getLocalName().equals( "row" ) ) { String rowIndicator = sheetReader.getAttributeValue( null, "r" ); currentRow = Integer.parseInt( rowIndicator ); if ( currentRow < rownr + 1 ) { continue; } currentRowCells = parseRow(); return currentRowCells; } } } catch ( Exception e ) { throw new RuntimeException( e ); } numRows = currentRow; return new KCell[] {}; } StaxPoiSheet( XSSFReader reader, String sheetName, String sheetID ); @Override KCell[] getRow( int rownr ); @Override String getName(); @Override int getRows(); @Override KCell getCell( int colnr, int rownr ); void close();  }### Answer:
@Test public void testNullDateCell() throws Exception { final String sheetId = "1"; final String sheetName = "Sheet 1"; XSSFReader reader = mockXSSFReader( sheetId, SHEET_DATE_NO_V, mockSharedStringsTable( "Some Date" ), mockStylesTable( Collections.singletonMap( 2, 165 ), Collections.singletonMap( 165, "M/D/YYYY" ) ) ); StaxPoiSheet spSheet = new StaxPoiSheet( reader, sheetName, sheetId ); KCell cell = spSheet.getRow( 1 )[0]; assertNotNull( cell ); assertEquals( KCellType.DATE, cell.getType() ); cell = spSheet.getRow( 2 )[0]; assertNull( "cell must be null", cell ); }
@Test public void testReadSameRow() throws Exception { KSheet sheet1 = getSampleSheet(); KCell[] row = sheet1.getRow( 3 ); assertEquals( "Two", row[1].getValue() ); row = sheet1.getRow( 3 ); assertEquals( "Two", row[1].getValue() ); }
@Test public void testReadRowRA() throws Exception { KSheet sheet1 = getSampleSheet(); KCell[] row = sheet1.getRow( 4 ); assertEquals( "Three", row[1].getValue() ); row = sheet1.getRow( 2 ); assertEquals( "One", row[1].getValue() ); }
@Test public void testReadEmptyRow() throws Exception { KSheet sheet1 = getSampleSheet(); KCell[] row = sheet1.getRow( 0 ); assertEquals( "empty row expected", 0, row.length ); }