PageRange implements PagesSelection { @Override public SortedSet<Integer> getPages(int totalNumberOfPage) { SortedSet<Integer> retSet = new TreeSet<Integer>(); for (int i = start; i <= totalNumberOfPage && i <= end; i++) { retSet.add(i); } return retSet; } PageRange();  PageRange(int start, int end);  PageRange(int start); int getStart(); int getEnd(); boolean isUnbounded(); boolean intersects(PageRange range); @Override SortedSet<Integer> getPages(int totalNumberOfPage); boolean contains(int page); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object other); static PageRange one(int page);  }
@Test public void testGetPages() { PageRange victim = new PageRange(1, 9); assertEquals(9, victim.getPages(50).size()); PageRange victim2 = new PageRange(10); assertEquals(16, victim2.getPages(25).size()); }