AdmobAdapterCalculator { public boolean canShowAdAtPosition(int position, int fetchedAdsCount) { return isAdPosition(position) && isAdAvailable(position, fetchedAdsCount); }  int getNoOfDataBetweenAds(); void setNoOfDataBetweenAds(int mNoOfDataBetweenAds); int getFirstAdIndex(); void setFirstAdIndex(int firstAdIndex); int getLimitOfAds(); void setLimitOfAds(int mLimitOfAds); int getAdsCountToPublish(int fetchedAdsCount, int sourceItemsCount); int getOriginalContentPosition(int position, int fetchedAdsCount, int sourceItemsCount); int translateAdToWrapperPosition(int adPos); int translateSourceIndexToWrapperPosition(int sourcePos, int fetchedAdsCount); boolean canShowAdAtPosition(int position, int fetchedAdsCount); int getAdIndex(int position); boolean isAdPosition(int position); int getOffsetValue(); boolean isAdAvailable(int position, int fetchedAdsCount); boolean hasToFetchAd(int position, int fetchingAdsCount);  }
@Test public void testCanShowAdAtPosition0_fetchedCntIs3_Success() throws Exception { setupAdmobAdapterCalculatorHelper(10, 0, 10); assertThat(admobAdapterCalculator.canShowAdAtPosition(0, 3), is(true)); }
@Test public void testCanShowAdAtPosition22_fetchedCntIs3_Success() throws Exception { setupAdmobAdapterCalculatorHelper(10, 0, 10); assertThat(admobAdapterCalculator.canShowAdAtPosition(22, 3), is(true)); }
@Test public void testCanShowAdAtPosition33_fetchedCntIs3_Fail() throws Exception { setupAdmobAdapterCalculatorHelper(10, 0, 10); assertThat(admobAdapterCalculator.canShowAdAtPosition(33, 3), is(false)); }
@Test public void testCanShowAdAtPosition0_fetchedCntIs0_Fail() throws Exception { setupAdmobAdapterCalculatorHelper(10, 0, 10); assertThat(admobAdapterCalculator.canShowAdAtPosition(0, 0), is(false)); }
@Test public void testCanShowAdAtPosition99_firstIdxIs99_Success() throws Exception { setupAdmobAdapterCalculatorHelper(10, 99, 10); assertThat(admobAdapterCalculator.canShowAdAtPosition(99, 10), is(true)); }
@Test public void testCanShowAdAtPosition98_firstIdxIs99_Fail() throws Exception { setupAdmobAdapterCalculatorHelper(10, 99, 10); assertThat(admobAdapterCalculator.canShowAdAtPosition(98, 10), is(false)); }
@Test public void testCanShowAdAtPosition100_firstIdxIs99_Fail() throws Exception { setupAdmobAdapterCalculatorHelper(10, 99, 10); assertThat(admobAdapterCalculator.canShowAdAtPosition(100, 10), is(false)); }
@Test public void testCanShowAdAtPosition10_firstIdxIs10_Success() throws Exception { setupAdmobAdapterCalculatorHelper(10, 10, 10); assertThat(admobAdapterCalculator.canShowAdAtPosition(10, 10), is(true)); }
@Test public void testCanShowAdAtPosition0_itemsBetweenAds0_Success() throws Exception { setupAdmobAdapterCalculatorHelper(0, 0, 200); assertThat(admobAdapterCalculator.canShowAdAtPosition(0, 200), is(true)); }
@Test public void testCanShowAdAtPosition0_limitAdsIs0_Fail() throws Exception { setupAdmobAdapterCalculatorHelper(10, 0, 0); assertThat(admobAdapterCalculator.canShowAdAtPosition(0, 100), is(false)); }