GridDataView extends AbstractDataView<T> { @Override public T getItem(int index) { return dataCommunicator.getItem(index); } GridDataView(DataCommunicator<T> dataCommunicator,
                        Grid<T> grid); @Override T getItem(int index); @Override Stream<T> getItems(); @Override void setIdentifierProvider(
            IdentifierProvider<T> identifierProvider);  }
@Test public void dataViewWithItems_getItem_returnsCorrectItem() { Assert.assertEquals(items.get(0), dataView.getItem(0)); Assert.assertEquals(items.get(1), dataView.getItem(1)); Assert.assertEquals(items.get(2), dataView.getItem(2)); }
@SuppressWarnings({ "unchecked", "rawtypes" }) @Test public void getItem_itemRequested_dataCommunicatorInvoked() { DataCommunicator<String> dataCommunicator = Mockito .mock(DataCommunicator.class); Mockito.when(dataCommunicator.getDataProvider()) .thenReturn((DataProvider) DataProvider.ofItems()); GridDataView<String> dataView = new GridDataView<>(dataCommunicator, new Grid<>()); dataView.getItem(42); Mockito.verify(dataCommunicator).getItem(42); }