### Question:
PaginationUtil { public static <T> PaginationList<T> getPaginationList(List<T> all, int nowPageIndex) { return getPaginationList(all, nowPageIndex, Pagination.DEFAULT_PAGESIZE); }  static PaginationList<T> getPaginationList(List<T> all, int nowPageIndex); static PaginationList<T> getPaginationList(List<T> all, int nowPageIndex, int pageSize); static PaginationList<T> getPaginationList(List<T> all, Pagination pagination, int nowPageIndex,
                                                          int pageSize);  }### Answer:
@Test public void testgetPaginationList() { List<String> all = new ArrayList<String>(); for (int i = 0; i < 30; i++) { all.add("" + i); } List<String> paginationList = PaginationUtil.getPaginationList(all, 1); assertEquals(30, paginationList.size()); assertEquals("0", paginationList.get(0)); assertEquals("9", paginationList.get(9)); }
@Test public void testgetPaginationList2() { List<String> all = new ArrayList<String>(); for (int i = 0; i < 30; i++) { all.add("" + i); } List<String> paginationList = PaginationUtil.getPaginationList(all, 1, 5); assertEquals(5, paginationList.size()); assertEquals("0", paginationList.get(0)); assertEquals("4", paginationList.get(4)); }
@Test public void testgetPaginationList3() { List<String> all = new ArrayList<String>(); for (int i = 0; i < 3; i++) { all.add("" + i); } List<String> paginationList = PaginationUtil.getPaginationList(all, 1, 5); assertEquals(3, paginationList.size()); assertEquals("0", paginationList.get(0)); assertEquals("2", paginationList.get(2)); }
@Test public void testgetPaginationList4() { List<String> all = new ArrayList<String>(); for (int i = 0; i < 3; i++) { all.add("" + i); } List<String> paginationList = PaginationUtil.getPaginationList(all, 2, 5); assertEquals(0, paginationList.size()); }
@Test public void testgetPaginationList5() { List<String> all = new ArrayList<String>(); List<String> paginationList = PaginationUtil.getPaginationList(all, 1, 5); assertEquals(0, paginationList.size()); }