Search in sources :

Example 6 with Pagination

use of org.hisp.dhis.query.Pagination in project dhis2-core by dhis2.

the class PaginationUtilsTest method verifyPaginationCalculation.

@Test
void verifyPaginationCalculation() {
    Map<String, String> options = new HashMap<>();
    options.put(WebOptions.PAGING, "true");
    options.put(WebOptions.PAGE, "14");
    options.put(WebOptions.PAGE_SIZE, "200");
    WebOptions webOptions = new WebOptions(options);
    Pagination paginationData = PaginationUtils.getPaginationData(webOptions);
    assertThat(paginationData.getFirstResult(), is(2600));
    assertThat(paginationData.getSize(), is(200));
}
Also used : Pagination(org.hisp.dhis.query.Pagination) HashMap(java.util.HashMap) WebOptions(org.hisp.dhis.webapi.webdomain.WebOptions) Test(org.junit.jupiter.api.Test)

Aggregations

Pagination (org.hisp.dhis.query.Pagination)6 HashMap (java.util.HashMap)4 WebOptions (org.hisp.dhis.webapi.webdomain.WebOptions)4 Test (org.junit.jupiter.api.Test)4 Query (org.hisp.dhis.query.Query)2 Pager (org.hisp.dhis.common.Pager)1 Order (org.hisp.dhis.query.Order)1 CurrentUser (org.hisp.dhis.user.CurrentUser)1 User (org.hisp.dhis.user.User)1 MessageConversation (org.hisp.dhis.webapi.webdomain.MessageConversation)1