AdTypeTranslator { static String getCustomEventNameForAdType(MoPubView moPubView, String adType, String fullAdType) { CustomEventType customEventType; if ("html".equals(adType) || "mraid".equals(adType)) { customEventType = (isInterstitial(moPubView)) ? CustomEventType.fromString(adType + "_interstitial") : CustomEventType.fromString(adType + "_banner"); } else { customEventType = ("interstitial".equals(adType)) ? CustomEventType.fromString(fullAdType + "_interstitial") : CustomEventType.fromString(adType + "_banner"); } return customEventType.toString(); }    }
@Test public void getAdMobBannerReturnsGooglePlayServicesBanner() throws Exception { customEventName = AdTypeTranslator.getCustomEventNameForAdType(moPubView, "admob_native", null); assertThat(customEventName).isEqualTo("com.mopub.mobileads.GooglePlayServicesBanner"); }
@Test public void getAdMobInterstitialReturnsGooglePlayServicesInterstitial() throws Exception { customEventName = AdTypeTranslator.getCustomEventNameForAdType(moPubInterstitialView, "interstitial", "admob_full"); assertThat(customEventName).isEqualTo("com.mopub.mobileads.GooglePlayServicesInterstitial"); }
@Test public void getMillennialBanner() throws Exception { customEventName = AdTypeTranslator.getCustomEventNameForAdType(moPubView, "millennial_native", null); assertThat(customEventName).isEqualTo("com.mopub.mobileads.MillennialBanner"); }
@Test public void getMillennnialInterstitial() throws Exception { customEventName = AdTypeTranslator.getCustomEventNameForAdType(moPubInterstitialView, "interstitial", "millennial_full"); assertThat(customEventName).isEqualTo("com.mopub.mobileads.MillennialInterstitial"); }
@Test public void getMraidBanner() throws Exception { customEventName = AdTypeTranslator.getCustomEventNameForAdType(moPubView, "mraid", null); assertThat(customEventName).isEqualTo("com.mopub.mraid.MraidBanner"); }
@Test public void getMraidInterstitial() throws Exception { customEventName = AdTypeTranslator.getCustomEventNameForAdType(moPubInterstitialView, "mraid", null); assertThat(customEventName).isEqualTo("com.mopub.mraid.MraidInterstitial"); }
@Test public void getHtmlBanner() throws Exception { customEventName = AdTypeTranslator.getCustomEventNameForAdType(moPubView, "html", null); assertThat(customEventName).isEqualTo("com.mopub.mobileads.HtmlBanner"); }
@Test public void getHtmlInterstitial() throws Exception { customEventName = AdTypeTranslator.getCustomEventNameForAdType(moPubInterstitialView, "html", null); assertThat(customEventName).isEqualTo("com.mopub.mobileads.HtmlInterstitial"); }
@Test public void getVastInterstitial() throws Exception { customEventName = AdTypeTranslator.getCustomEventNameForAdType(moPubInterstitialView, "interstitial", "vast"); assertThat(customEventName).isEqualTo("com.mopub.mobileads.VastVideoInterstitial"); }
@Test public void getCustomEventNameForAdType_whenSendingNonsense_shouldReturnNull() throws Exception { customEventName = AdTypeTranslator.getCustomEventNameForAdType(null, null, null); assertThat(customEventName).isNull(); }