@Test public void testTranslateSourceIndexToWrapperPosition_Position89_Fetched10_Result98() throws Exception { setupAdmobAdapterCalculatorHelper(10, 0, 10); assertThat(admobAdapterCalculator.translateSourceIndexToWrapperPosition(89,10), is(98)); }
public int translateSourceIndexToWrapperPosition(int sourcePos, int fetchedAdsCount) { int adSpacesCount = 0; if(sourcePos >= getOffsetValue() && getNoOfDataBetweenAds() > 0) adSpacesCount = (sourcePos - getOffsetValue())/getNoOfDataBetweenAds() + 1; adSpacesCount = Math.min(fetchedAdsCount, adSpacesCount); adSpacesCount = Math.max(0, adSpacesCount); adSpacesCount = Math.min(adSpacesCount, getLimitOfAds()); int wrappedPosition = sourcePos + adSpacesCount; return wrappedPosition; }
AdmobAdapterCalculator { public int translateSourceIndexToWrapperPosition(int sourcePos, int fetchedAdsCount) { int adSpacesCount = 0; if(sourcePos >= getOffsetValue() && getNoOfDataBetweenAds() > 0) adSpacesCount = (sourcePos - getOffsetValue())/getNoOfDataBetweenAds() + 1; adSpacesCount = Math.min(fetchedAdsCount, adSpacesCount); adSpacesCount = Math.max(0, adSpacesCount); adSpacesCount = Math.min(adSpacesCount, getLimitOfAds()); int wrappedPosition = sourcePos + adSpacesCount; return wrappedPosition; } }
AdmobAdapterCalculator { public int translateSourceIndexToWrapperPosition(int sourcePos, int fetchedAdsCount) { int adSpacesCount = 0; if(sourcePos >= getOffsetValue() && getNoOfDataBetweenAds() > 0) adSpacesCount = (sourcePos - getOffsetValue())/getNoOfDataBetweenAds() + 1; adSpacesCount = Math.min(fetchedAdsCount, adSpacesCount); adSpacesCount = Math.max(0, adSpacesCount); adSpacesCount = Math.min(adSpacesCount, getLimitOfAds()); int wrappedPosition = sourcePos + adSpacesCount; return wrappedPosition; }  }
AdmobAdapterCalculator { public int translateSourceIndexToWrapperPosition(int sourcePos, int fetchedAdsCount) { int adSpacesCount = 0; if(sourcePos >= getOffsetValue() && getNoOfDataBetweenAds() > 0) adSpacesCount = (sourcePos - getOffsetValue())/getNoOfDataBetweenAds() + 1; adSpacesCount = Math.min(fetchedAdsCount, adSpacesCount); adSpacesCount = Math.max(0, adSpacesCount); adSpacesCount = Math.min(adSpacesCount, getLimitOfAds()); int wrappedPosition = sourcePos + adSpacesCount; return wrappedPosition; }  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 int translateSourceIndexToWrapperPosition(int sourcePos, int fetchedAdsCount) { int adSpacesCount = 0; if(sourcePos >= getOffsetValue() && getNoOfDataBetweenAds() > 0) adSpacesCount = (sourcePos - getOffsetValue())/getNoOfDataBetweenAds() + 1; adSpacesCount = Math.min(fetchedAdsCount, adSpacesCount); adSpacesCount = Math.max(0, adSpacesCount); adSpacesCount = Math.min(adSpacesCount, getLimitOfAds()); int wrappedPosition = sourcePos + adSpacesCount; return wrappedPosition; }  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);  }