LinkHeaderResponseFilter implements ContainerResponseFilter { protected Integer getNextPage(Page<?> page) { Integer next = page.getPageRequest().getPage() + 1; return (next > getLastPage(page)) ? null : next; } @Inject  LinkHeaderResponseFilter(Configuration config,
        @Named("PREFIX_APIURL_KEY") String apiUrlPrefixKey); @SuppressWarnings("rawtypes") void filter(ContainerRequestContext reqContext, ContainerResponseContext respContext); static final int MAX_LINK_LENGTH; static final String LINK_HEADER; static final String TOTAL_RECORDS_COUNT; static final String LINK_TYPE; }
@Test public void testGetNextPage() { Page<Object> p = new Page<>(); p.setMaxRecords(55); PageRequest pr = new PageRequest(); p.setPageRequest(pr); pr.setPerPage(10); pr.setPage(3); assertEquals(Integer.valueOf(4), interceptor.getNextPage(p)); }
@Test public void testGetNextPageWhenNoNextAvailable() { Page<Object> p = new Page<>(); p.setMaxRecords(55); PageRequest pr = new PageRequest(); p.setPageRequest(pr); pr.setPerPage(10); pr.setPage(6); assertNull(interceptor.getNextPage(p)); }