@Test public void shouldReturnSecondPage1() { List<String> list = Arrays.asList("a", "b", "c", "d", "e", "f"); List<String> page = Paging.asPage(list, 1, 2).getPage(); assertEquals(Arrays.asList("b"), page); }
@Test public void shouldReturnLastPage2() { List<String> list = Arrays.asList("a", "b", "c", "d", "e", "f"); List<String> page = Paging.asPage(list, 2, 3).getPage(); assertEquals(Arrays.asList("e", "f"), page); }
@Test public void shouldReturnAll() { List<String> list = Arrays.asList("a", "b", "c", "d", "e", "f"); List<String> page = Paging.asPage(list, -1, -1).getPage(); assertEquals(list, page); }