List<Object> page4 = Arrays.asList(new Object[] {10, 11, 12});
List<Object> page5 = Arrays.asList(new Object[] {13});
List<Object> items = Arrays.asList(new Object[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13});
Paginator pager = new Paginator(items.size(), 3);
assertEquals(1, pager.firstPage());
assertEquals(5, pager.lastPage());
pager.go(1);
assertEquals(1, pager.getCurrentPage());
assertEquals(page1, pager.slice(items));
pager.go(2);
assertEquals(2, pager.getCurrentPage());
assertEquals(page2, pager.slice(items));
pager.go(3);
assertEquals(3, pager.getCurrentPage());
assertEquals(page3, pager.slice(items));
pager.go(4);
assertEquals(4, pager.getCurrentPage());
assertEquals(page4, pager.slice(items));
pager.go(5);
assertEquals(5, pager.getCurrentPage());
assertEquals(page5, pager.slice(items));
// pager may not overrun boundaries
pager.go(6);
assertEquals(5, pager.getCurrentPage());
assertEquals(page5, pager.slice(items));
}