GridLazyDataView extends AbstractLazyDataView<T> { public void setItemCountCallback( CallbackDataProvider.CountCallback<T, Void> callback) { getDataCommunicator().setCountCallback(callback); } GridLazyDataView(DataCommunicator<T> dataCommunicator,
            Grid<T> component); void setItemCountCallback(
            CallbackDataProvider.CountCallback<T, Void> callback); @Override void setItemCountFromDataProvider(); @Override void setItemCountEstimate(int itemCountEstimate); @Override void setItemCountUnknown();  }
@Test public void setItemCountCallback_setAnotherCountCallback_itemCountChanged() { final AtomicInteger itemCount = new AtomicInteger(0); dataView.addItemCountChangeListener( event -> itemCount.set(event.getItemCount())); grid.getDataCommunicator().setRequestedRange(0, 50); dataView.setItemCountCallback(query -> 2); fakeClientCommunication(); Assert.assertEquals("Invalid item count reported", 2, itemCount.get()); }