AbstractListDataView extends AbstractDataView<T> implements ListDataView<T, AbstractListDataView<T>> { @Override public T getItem(int index) { validateItemIndex(index); return getItems().skip(index).findFirst().orElse(null); } AbstractListDataView(
            SerializableSupplier<? extends DataProvider<T, ?>> dataProviderSupplier,
            Component component); @Override int getItemCount(); @Override T getItem(int index); @Override Optional<T> getNextItem(T item); @Override Optional<T> getPreviousItem(T item); @Override AbstractListDataView<T> addFilter(SerializablePredicate<T> filter); @Override AbstractListDataView<T> removeFilters(); @Override AbstractListDataView<T> setFilter(SerializablePredicate<T> filter); @Override AbstractListDataView<T> setSortComparator(
            SerializableComparator<T> sortComparator); @Override AbstractListDataView<T> addSortComparator(
            SerializableComparator<T> sortComparator); @Override AbstractListDataView<T> removeSorting(); @Override AbstractListDataView<T> setSortOrder(
            ValueProvider<T, V1> valueProvider, SortDirection sortDirection); @Override AbstractListDataView<T> addSortOrder(
            ValueProvider<T, V1> valueProvider, SortDirection sortDirection); @Override boolean contains(T item); @Override AbstractListDataView<T> addItem(T item); @Override AbstractListDataView<T> addItems(Collection<T> items); @Override AbstractListDataView<T> addItemAfter(T item, T after); @Override AbstractListDataView<T> addItemBefore(T item, T before); @Override AbstractListDataView<T> addItemsAfter(Collection<T> items, T after); @Override AbstractListDataView<T> addItemsBefore(Collection<T> items,
            T before); @Override AbstractListDataView<T> removeItem(T item); @Override AbstractListDataView<T> removeItems(Collection<T> items);  }
@Test public void getItem_correctIndex_itemFound() { Assert.assertEquals("Wrong item returned for index", "first", dataView.getItem(0)); }
@Test public void getItem_negativeIndex_throwsException() { exceptionRule.expect(IndexOutOfBoundsException.class); exceptionRule.expectMessage( "Given index -1 is outside of the accepted range '0 - 2'"); dataView.getItem(-1); }
@Test public void getItem_emptyDataSet_throwsException() { dataProvider = DataProvider.ofItems(); exceptionRule.expect(IndexOutOfBoundsException.class); exceptionRule.expectMessage("Requested index 0 on empty data."); dataView.getItem(0); }
@Test public void getItem_indexOutsideOfSize_throwsException() { exceptionRule.expect(IndexOutOfBoundsException.class); dataView.getItem(items.size()); }