Search in sources :

Example 1 with PageResponse

use of org.molgenis.api.model.response.PageResponse in project molgenis by molgenis.

the class PageUtilsTest method getPageResponse.

@Test
void getPageResponse() {
    PageResponse pageResponse = PageResponse.builder().setSize(10).setNumber(0).setTotalPages(9).setTotalElements(90).build();
    assertEquals(pageResponse, PageUtils.getPageResponse(10, 0, 90));
}
Also used : PageResponse(org.molgenis.api.model.response.PageResponse) Test(org.junit.jupiter.api.Test)

Example 2 with PageResponse

use of org.molgenis.api.model.response.PageResponse in project molgenis by molgenis.

the class PermissionResponseUtils method getPermissionResponse.

static PagedApiResponse getPermissionResponse(String query, int page, int pageSize, int totalItems, Object data) {
    PageResponse pageResponse = PageResponse.create(pageSize, totalItems, page);
    LinksResponse linksResponse = getLinks(query, page, pageSize, totalItems);
    return PagedApiResponse.create(pageResponse, linksResponse, data);
}
Also used : LinksResponse(org.molgenis.api.model.response.LinksResponse) PageResponse(org.molgenis.api.model.response.PageResponse)

Example 3 with PageResponse

use of org.molgenis.api.model.response.PageResponse in project molgenis by molgenis.

the class PageUtilsTest method getPageResponseTotalPagesRounding.

@Test
void getPageResponseTotalPagesRounding() {
    PageResponse pageResponse = PageResponse.builder().setSize(10).setNumber(0).setTotalPages(9).setTotalElements(89).build();
    assertEquals(pageResponse, PageUtils.getPageResponse(10, 0, 89));
}
Also used : PageResponse(org.molgenis.api.model.response.PageResponse) Test(org.junit.jupiter.api.Test)

Aggregations

PageResponse (org.molgenis.api.model.response.PageResponse)3 Test (org.junit.jupiter.api.Test)2 LinksResponse (org.molgenis.api.model.response.LinksResponse)1