### Question:
Filter { public Filter page(int pageNo, int perPage) { this.pageNo = pageNo > 0 ? pageNo : 1; this.perPage = (perPage < 1) ? Integer.MAX_VALUE : perPage; return this; } Filter(Class<?> clazz);  Filter(int perPage, int pageNo, Condition... conditions);  Filter();  Filter(Condition... conditions); Filter condition(String name, Object value); Filter condition(String name, Operator operator, Object value); Filter page(int pageNo, int perPage); Filter sortBy(String name, boolean asc); Filter sortBy(SortField sortField); Filter cacheable(boolean cacheable); Filter clone(boolean paginate); List<T> list(); long count(); void delete();  }### Answer:
@Test public void shouldSetPage() { Filter filter = new Filter(); filter.page(2, 20); assertEquals(filter.getPageNo(), 2); assertEquals(filter.getPerPage(), 20); }
@Test public void shouldFixPageIfOutOfBounds() { Filter filter = new Filter(); filter.page(0, 0); assertEquals(filter.getPageNo(), 1); assertEquals(filter.getPerPage(), Integer.MAX_VALUE); }