@Test public void testIsAdAvailable_position10_firstIdxIs10_Success() throws Exception { setupAdmobAdapterCalculatorHelper(10, 10, 10); assertThat(admobAdapterCalculator.isAdAvailable(10, 10), is(true)); }
public boolean isAdAvailable(int position, int fetchedAdsCount) { if(fetchedAdsCount == 0) return false; int adIndex = getAdIndex(position); int firstAdPos = getOffsetValue(); return position >= firstAdPos && adIndex >= 0 && adIndex < getLimitOfAds() && adIndex < fetchedAdsCount; }
AdmobAdapterCalculator { public boolean isAdAvailable(int position, int fetchedAdsCount) { if(fetchedAdsCount == 0) return false; int adIndex = getAdIndex(position); int firstAdPos = getOffsetValue(); return position >= firstAdPos && adIndex >= 0 && adIndex < getLimitOfAds() && adIndex < fetchedAdsCount; } }
AdmobAdapterCalculator { public boolean isAdAvailable(int position, int fetchedAdsCount) { if(fetchedAdsCount == 0) return false; int adIndex = getAdIndex(position); int firstAdPos = getOffsetValue(); return position >= firstAdPos && adIndex >= 0 && adIndex < getLimitOfAds() && adIndex < fetchedAdsCount; }  }
AdmobAdapterCalculator { public boolean isAdAvailable(int position, int fetchedAdsCount) { if(fetchedAdsCount == 0) return false; int adIndex = getAdIndex(position); int firstAdPos = getOffsetValue(); return position >= firstAdPos && adIndex >= 0 && adIndex < getLimitOfAds() && adIndex < 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); }
AdmobAdapterCalculator { public boolean isAdAvailable(int position, int fetchedAdsCount) { if(fetchedAdsCount == 0) return false; int adIndex = getAdIndex(position); int firstAdPos = getOffsetValue(); return position >= firstAdPos && adIndex >= 0 && adIndex < getLimitOfAds() && adIndex < 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);  }