@Test
public void testReadRows() throws Exception {

  Query query = Query.create(TABLE_ID);
  when(delegate.readFlatRows(query.toProto(REQUEST_CONTEXT))).thenReturn(mockFlatRowScanner);
  when(mockFlatRowScanner.next())
      .thenReturn(SAMPLE_FLAT_ROW)
      .thenReturn(SAMPLE_FLAT_ROW)
      .thenReturn(SAMPLE_FLAT_ROW)
      .thenReturn(null);
  doNothing().when(mockFlatRowScanner).close();
  try (org.apache.hadoop.hbase.client.ResultScanner actualResult =
      dataClientWrapper.readRows(query)) {
    assertArrayEquals(
        FLAT_ROW_ADAPTER.adaptResponse(SAMPLE_FLAT_ROW).rawCells(),
        actualResult.next().rawCells());
    assertEquals(2, actualResult.next(5).length);
  }
  verify(mockFlatRowScanner, times(4)).next();
  verify(mockFlatRowScanner).close();
  verify(delegate).readFlatRows(query.toProto(REQUEST_CONTEXT));
}