PagingRequest implements ImmutableBean { public static PagingRequest ofPageDefaulted(int page, int pagingSize) { page = (page == 0 ? 1 : page); pagingSize = (pagingSize == 0 ? DEFAULT_PAGING_SIZE : pagingSize); return PagingRequest.ofPage(page, pagingSize); } @ImmutableConstructor private  PagingRequest(final int index, final int size); static PagingRequest ofIndex(int index, int size); static PagingRequest ofPage(int page, int pagingSize); static PagingRequest ofPageDefaulted(int page, int pagingSize); int getFirstItem(); int getPagingSize(); int getFirstItemOneBased(); int getLastItem(); int getLastItemOneBased(); List<T> select(List<T> list); @Override String toString(); static PagingRequest.Meta meta(); @Override PagingRequest.Meta metaBean(); @Override Property<R> property(String propertyName); @Override Set<String> propertyNames(); @Override boolean equals(Object obj); @Override int hashCode(); static final int DEFAULT_PAGING_SIZE; static final PagingRequest ALL; static final PagingRequest FIRST_PAGE; static final PagingRequest ONE; static final PagingRequest NONE; }
@Test(expectedExceptions = IllegalArgumentException.class) public void test_ofPageDefaulted_2ints_pageNegative() { PagingRequest.ofPageDefaulted(-1, 40); }
@Test(expectedExceptions = IllegalArgumentException.class) public void test_ofPageDefaulted_2ints_pagingSizeNegative() { PagingRequest.ofPageDefaulted(1, -1); }