### Question:
ProductCollectionImpl implements ProductCollection { public Integer calculateCurrentPageCursor(final String currentPageIndexCandidate) { try { int i = Integer.parseInt(currentPageIndexCandidate); if (i < 1) { i = 1; } return i; } catch (NumberFormatException x) { return 1; } }  Integer calculateCurrentPageCursor(final String currentPageIndexCandidate); @Override boolean loadClientPrice(); @Override String getPaginationType(); @Nonnull @Override Collection<ProductListItem> getProducts(); @Nonnull @Override SearchResultsSet getSearchResultsSet();  }### Answer:
@Test public void testCalculateCurrentPageCursor() { productCollectionModel = context.request().adaptTo(ProductCollectionImpl.class); Assert.assertEquals("negative page indexes are not allowed", 1, productCollectionModel.calculateCurrentPageCursor("-1").intValue()); Assert.assertEquals("null value is dealt with", 1, productCollectionModel.calculateCurrentPageCursor(null).intValue()); Assert.assertEquals("non numeric value is dealt with", 1, productCollectionModel.calculateCurrentPageCursor("a").intValue()); Assert.assertEquals("extra large value is dealt with", 1, productCollectionModel.calculateCurrentPageCursor("99999999999999").intValue()); }