AbstractLazyDataView extends AbstractDataView<T> implements LazyDataView<T> { @SuppressWarnings("unchecked") @Override public Stream<T> getItems() { DataCommunicator<T> verifiedDataCommunicator = getDataCommunicator(); if (verifiedDataCommunicator.isDefinedSize()) { return verifiedDataCommunicator.getDataProvider() .fetch(verifiedDataCommunicator.buildQuery(0, verifiedDataCommunicator.getItemCount())); } else { return verifiedDataCommunicator.getDataProvider().fetch( verifiedDataCommunicator.buildQuery(0, Integer.MAX_VALUE)); } } AbstractLazyDataView(DataCommunicator<T> dataCommunicator,
            Component component); @Override T getItem(int index); @SuppressWarnings("unchecked") @Override Stream<T> getItems(); @Override void setItemCountEstimate(int itemCountEstimate); @Override int getItemCountEstimate(); @Override void setItemCountEstimateIncrease(int itemCountEstimateIncrease); @Override int getItemCountEstimateIncrease(); @Override void setItemCountFromDataProvider(); @Override void setItemCountUnknown();  }
@Test public void getItems_withDefinedSize() { dataCommunicator.setRequestedRange(0, 50); dataCommunicator.setDataProvider(DataProvider.fromCallbacks(query -> { query.getOffset(); query.getLimit(); return Stream.generate(String::new).limit(99); }, query -> 99), null); Stream<String> items = dataView.getItems(); Assert.assertEquals("Invalid amount of items returned", 99, items.count()); }