@Test public void fromAdResponse_whenCustomEvent_shouldCreateAdLoadTask() throws Exception { adResponse = adResponse.toBuilder() .setAdType("custom") .setCustomEventClassName("custom event name") .setServerExtras(serverExtras) .build(); AdLoader.CustomEventAdLoader customEventTask = (AdLoader.CustomEventAdLoader) AdLoader.fromAdResponse(adResponse, adViewController); assertThat(customEventTask).isNotNull(); assertThat(customEventTask.getServerExtras()).isEqualTo(serverExtras); }
@Nullable static AdLoader fromAdResponse(AdResponse response, AdViewController adViewController) { MoPubLog.i("Performing custom event."); String adTypeCustomEventName = response.getCustomEventClassName(); if (adTypeCustomEventName != null) { Map<String, String> customEventData = response.getServerExtras(); return new CustomEventAdLoader(adViewController, adTypeCustomEventName, customEventData); } MoPubLog.i("Failed to create custom event."); return null; }
AdLoader { @Nullable static AdLoader fromAdResponse(AdResponse response, AdViewController adViewController) { MoPubLog.i("Performing custom event."); String adTypeCustomEventName = response.getCustomEventClassName(); if (adTypeCustomEventName != null) { Map<String, String> customEventData = response.getServerExtras(); return new CustomEventAdLoader(adViewController, adTypeCustomEventName, customEventData); } MoPubLog.i("Failed to create custom event."); return null; } }
AdLoader { @Nullable static AdLoader fromAdResponse(AdResponse response, AdViewController adViewController) { MoPubLog.i("Performing custom event."); String adTypeCustomEventName = response.getCustomEventClassName(); if (adTypeCustomEventName != null) { Map<String, String> customEventData = response.getServerExtras(); return new CustomEventAdLoader(adViewController, adTypeCustomEventName, customEventData); } MoPubLog.i("Failed to create custom event."); return null; } AdLoader(AdViewController adViewController); }
AdLoader { @Nullable static AdLoader fromAdResponse(AdResponse response, AdViewController adViewController) { MoPubLog.i("Performing custom event."); String adTypeCustomEventName = response.getCustomEventClassName(); if (adTypeCustomEventName != null) { Map<String, String> customEventData = response.getServerExtras(); return new CustomEventAdLoader(adViewController, adTypeCustomEventName, customEventData); } MoPubLog.i("Failed to create custom event."); return null; } AdLoader(AdViewController adViewController);  }
AdLoader { @Nullable static AdLoader fromAdResponse(AdResponse response, AdViewController adViewController) { MoPubLog.i("Performing custom event."); String adTypeCustomEventName = response.getCustomEventClassName(); if (adTypeCustomEventName != null) { Map<String, String> customEventData = response.getServerExtras(); return new CustomEventAdLoader(adViewController, adTypeCustomEventName, customEventData); } MoPubLog.i("Failed to create custom event."); return null; } AdLoader(AdViewController adViewController);   }