Paginator implements Serializable, CloneableObject<Paginator> { public int setItems(int items) { this.items = items >= 0 ? items : 0; setPage(page); return this.items; } Paginator();  Paginator(int itemsPerPage);  Paginator(int itemsPerPage, int items);  Paginator(PageSize pageSize);  Paginator(PageSize pageSize, int items); int getPages(); int getPage(); int setPage(int page); int getItems(); int setItems(int items); int getItemsPerPage(); int setItemsPerPage(int itemsPerPage); int setItemsPerPage(PageSize pageSize); int getOffset(); int getLength(); int getBeginIndex(); int getEndIndex(); int setItem(int itemOffset); int getFirstPage(); int getLastPage(); int getPreviousPage(); int getPreviousPage(int n); int getNextPage(); int getNextPage(int n); int getPrevious(); int getNext(); boolean isDisabledPage(int page); int[] getSlider(); int[] getSlider(int width); @Override Paginator clone(); @Override String toString(); static final int DEFAULT_ITEMS_PER_PAGE; static final int DEFAULT_SLIDER_SIZE; static final int UNKNOWN_ITEMS; }
@Test public void setItems() { pg.setItems(123); pg.setPage(11); pg.setItems(133); assertEquals(14, pg.getPages()); assertEquals(133, pg.getItems()); assertEquals(10, pg.getItemsPerPage()); assertEquals(11, pg.getPage()); assertEquals(1, pg.getFirstPage()); assertEquals(10, pg.getPreviousPage()); assertEquals(1, pg.getPreviousPage(10)); assertEquals(12, pg.getNextPage()); assertEquals(14, pg.getNextPage(10)); assertEquals(101, pg.getBeginIndex()); assertEquals(110, pg.getEndIndex()); assertEquals(100, pg.getOffset()); assertEquals(10, pg.getLength()); assertTrue(pg.isDisabledPage(0)); assertFalse(pg.isDisabledPage(1)); assertFalse(pg.isDisabledPage(2)); assertTrue(pg.isDisabledPage(11)); assertFalse(pg.isDisabledPage(13)); assertFalse(pg.isDisabledPage(14)); assertTrue(pg.isDisabledPage(15)); }