@Test public void testFetchPageWhenStartIndexTooBig() { final int bigStartingIndex = 3893; List<Long> expectedList = new ArrayList<Long>(); ListWrappingPageFetcher sut = new ListWrappingPageFetcher(wrappedList); assertEquals(expectedList, sut.fetchPage(bigStartingIndex, 3)); }
@Override public List<Long> fetchPage(final int inStartIndex, final int inPageSize) { int toIndex = inStartIndex + inPageSize; if (inStartIndex > wrappedList.size()) { return new ArrayList<Long>(); } if (toIndex > wrappedList.size()) { toIndex = wrappedList.size(); } return wrappedList.subList(inStartIndex, toIndex); }
ListWrappingPageFetcher implements PageFetcher<Long> { @Override public List<Long> fetchPage(final int inStartIndex, final int inPageSize) { int toIndex = inStartIndex + inPageSize; if (inStartIndex > wrappedList.size()) { return new ArrayList<Long>(); } if (toIndex > wrappedList.size()) { toIndex = wrappedList.size(); } return wrappedList.subList(inStartIndex, toIndex); } }
ListWrappingPageFetcher implements PageFetcher<Long> { @Override public List<Long> fetchPage(final int inStartIndex, final int inPageSize) { int toIndex = inStartIndex + inPageSize; if (inStartIndex > wrappedList.size()) { return new ArrayList<Long>(); } if (toIndex > wrappedList.size()) { toIndex = wrappedList.size(); } return wrappedList.subList(inStartIndex, toIndex); } ListWrappingPageFetcher(final List<Long> inWrappedList); }
ListWrappingPageFetcher implements PageFetcher<Long> { @Override public List<Long> fetchPage(final int inStartIndex, final int inPageSize) { int toIndex = inStartIndex + inPageSize; if (inStartIndex > wrappedList.size()) { return new ArrayList<Long>(); } if (toIndex > wrappedList.size()) { toIndex = wrappedList.size(); } return wrappedList.subList(inStartIndex, toIndex); } ListWrappingPageFetcher(final List<Long> inWrappedList); @Override List<Long> fetchPage(final int inStartIndex, final int inPageSize); }
ListWrappingPageFetcher implements PageFetcher<Long> { @Override public List<Long> fetchPage(final int inStartIndex, final int inPageSize) { int toIndex = inStartIndex + inPageSize; if (inStartIndex > wrappedList.size()) { return new ArrayList<Long>(); } if (toIndex > wrappedList.size()) { toIndex = wrappedList.size(); } return wrappedList.subList(inStartIndex, toIndex); } ListWrappingPageFetcher(final List<Long> inWrappedList); @Override List<Long> fetchPage(final int inStartIndex, final int inPageSize);  }