LimitData extends DataWrapper<T> { @NonNull @Override public T get(int position, int flags) { if (position >= size()) { throw new IndexOutOfBoundsException("Position: " + position + ", size: " + size()); } return mData.get(position, flags); } LimitData(@NonNull Data<? extends T> data);   LimitData(@NonNull Data<? extends T> data, int limit); int getLimit(); void setLimit(int limit); @NonNull @Override T get(int position, int flags); @Override int size();  }
@Test(expected = IndexOutOfBoundsException.class) public void getOutOfBoundsThrows() { mLimitedData.get(7); }