@Test public void testGetNextPageParameters() { PagerImpl pager = new PagerImpl(Collections.singletonMap(PARAMETER_KEY, PARAMETER_VALUE), TOTAL_PAGES, CURRENT_PAGE); final Map<String, String> previousPageParameters = pager.getNextPageParameters(); assertThat(previousPageParameters.size()).isEqualTo(2); }
@Nonnull @Override public Map<String, String> getNextPageParameters() { Integer nextPage = currentPageIndex >= totalPages ? totalPages : currentPageIndex + 1; Map<String, String> parameters = new HashMap<>(existingQueryParameters); parameters.put("page", nextPage.toString()); return parameters; }
PagerImpl implements Pager { @Nonnull @Override public Map<String, String> getNextPageParameters() { Integer nextPage = currentPageIndex >= totalPages ? totalPages : currentPageIndex + 1; Map<String, String> parameters = new HashMap<>(existingQueryParameters); parameters.put("page", nextPage.toString()); return parameters; } }
PagerImpl implements Pager { @Nonnull @Override public Map<String, String> getNextPageParameters() { Integer nextPage = currentPageIndex >= totalPages ? totalPages : currentPageIndex + 1; Map<String, String> parameters = new HashMap<>(existingQueryParameters); parameters.put("page", nextPage.toString()); return parameters; } PagerImpl(final Map<String, String> existingQueryParameters, final int totalPages, final int currentPageIndex); }
PagerImpl implements Pager { @Nonnull @Override public Map<String, String> getNextPageParameters() { Integer nextPage = currentPageIndex >= totalPages ? totalPages : currentPageIndex + 1; Map<String, String> parameters = new HashMap<>(existingQueryParameters); parameters.put("page", nextPage.toString()); return parameters; } PagerImpl(final Map<String, String> existingQueryParameters, final int totalPages, final int currentPageIndex); @Override int getCurrentPage(); @Override int getTotalPages(); @Nonnull @Override List<PagerPage> getPages(); @Nonnull @Override Map<String, String> getPreviousPageParameters(); @Nonnull @Override Map<String, String> getNextPageParameters(); @Override boolean getMorePagesBefore(); @Override boolean getMorePagesAfter(); }
PagerImpl implements Pager { @Nonnull @Override public Map<String, String> getNextPageParameters() { Integer nextPage = currentPageIndex >= totalPages ? totalPages : currentPageIndex + 1; Map<String, String> parameters = new HashMap<>(existingQueryParameters); parameters.put("page", nextPage.toString()); return parameters; } PagerImpl(final Map<String, String> existingQueryParameters, final int totalPages, final int currentPageIndex); @Override int getCurrentPage(); @Override int getTotalPages(); @Nonnull @Override List<PagerPage> getPages(); @Nonnull @Override Map<String, String> getPreviousPageParameters(); @Nonnull @Override Map<String, String> getNextPageParameters(); @Override boolean getMorePagesBefore(); @Override boolean getMorePagesAfter(); static final int MAXIMUM_PAGE_DISPLAY_COUNT; static final int PAGINATION_RANGE_SIZE; }