PageInfo { void setPageSize(int pageSize) { this.pageSize = max(1, pageSize); } PageInfo(int pageSize);   PageInfo(int pageSize, int page, int visible, int total); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); int getFrom(); int getTo(); int getPage(); int getPages(); int getPageSize(); int getVisible(); int getTotal();  }
@Test public void setPageSize() throws Exception { PageInfo pageInfo = new PageInfo(PAGE_SIZE, 0, 50, 100); assertEquals(10, pageInfo.getPages()); pageInfo.setPageSize(15); assertEquals(7, pageInfo.getPages()); pageInfo.setPageSize(20); assertEquals(5, pageInfo.getPages()); }