### Question:
Paginate { public Paginate(String key) { this.key = key; } Paginate(String key); void add(String item); List<String> getPage(int page, int pageSize); Long getTotalCount();  }### Answer:
@Test public void testPaginate() { Paginate topics = new Paginate("user-topics"); for (int i = 0; i < 24; ++i) { topics.add(i + ""); } assertEquals(24, topics.getTotalCount()); assertEquals(Arrays.asList("23", "22", "21", "20", "19"), topics.getPage(1, 5)); assertEquals(Arrays.asList("23", "22", "21", "20", "19", "18", "17", "16", "15", "14"), topics.getPage(1, 10)); assertEquals(Arrays.asList("3", "2", "1", "0"), topics.getPage(5, 5)); }