@Test public void fromAdResponse_whenCustomMethod_shouldReturnNull() { adResponse = adResponse.toBuilder() .setCustomEventClassName(null) .build(); assertThat(AdLoader.fromAdResponse(adResponse, adViewController)).isNull(); }
@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);   }