result.setLastRow(lastRow); return result;
result.setLastRow(lastRow); return result;
batch.setLastRow(totalRows);
BatchResults getBatchResults(List<?>[] batch, boolean isLast) { Batch batch2 = new Batch(batch, 1, batch.length); if (isLast) { batch2.setLastRow(batch.length); } BatchResults results = new BatchResults(null, batch2, BatchResults.DEFAULT_SAVED_BATCHES); if (!isLast) { results.setBatchFetcher(new MockBatchFetcher()); } return results; }
@Test public void testAbsoluteWithLastRow() throws Exception{ Batch batch = new Batch(createBatch(1, 10), 1, 10); batch.setLastRow(50); MockBatchFetcher mbf = new MockBatchFetcher(); mbf.setUseLastRow(true); BatchResults batchResults = new BatchResults(mbf, batch, BatchResults.DEFAULT_SAVED_BATCHES); assertTrue(batchResults.absolute(41)); assertEquals(Arrays.asList(41), batchResults.getCurrentRow()); //check to ensure that we skipped all the other batches assertEquals(Arrays.asList(41), mbf.batchCalls); }