@Test public void isValid_negative4() { UnifiedNativeAdRequestParams adRequestParams = mock(UnifiedNativeAdRequestParams.class); doReturn(true) .when(adRequestParams) .containsAssetType(MediaAssetType.Icon); doReturn(true) .when(adRequestParams) .containsAssetType(MediaAssetType.Image); Map<String, Object> params = new HashMap<>(); params.put(IabUtils.KEY_TITLE, "test_title"); params.put(IabUtils.KEY_CTA, "test_call_to_action"); params.put(IabUtils.KEY_ICON_URL, "test_icon_url"); NastParams nastParams = new NastParams(createParams(params)); boolean valid = nastParams.isValid(adRequestParams, mock(UnifiedAdCallback.class)); assertFalse(valid); }
@Override public boolean isValid(@NonNull UnifiedAdCallback callback) { if (TextUtils.isEmpty(title)) { callback.onAdLoadFailed(BMError.requestError("title not provided")); return false; } if (TextUtils.isEmpty(callToAction)) { callback.onAdLoadFailed(BMError.requestError("callToAction not provided")); return false; } return true; }
NastParams extends UnifiedParams { @Override public boolean isValid(@NonNull UnifiedAdCallback callback) { if (TextUtils.isEmpty(title)) { callback.onAdLoadFailed(BMError.requestError("title not provided")); return false; } if (TextUtils.isEmpty(callToAction)) { callback.onAdLoadFailed(BMError.requestError("callToAction not provided")); return false; } return true; } }
NastParams extends UnifiedParams { @Override public boolean isValid(@NonNull UnifiedAdCallback callback) { if (TextUtils.isEmpty(title)) { callback.onAdLoadFailed(BMError.requestError("title not provided")); return false; } if (TextUtils.isEmpty(callToAction)) { callback.onAdLoadFailed(BMError.requestError("callToAction not provided")); return false; } return true; } NastParams(@NonNull UnifiedMediationParams mediationParams); }
NastParams extends UnifiedParams { @Override public boolean isValid(@NonNull UnifiedAdCallback callback) { if (TextUtils.isEmpty(title)) { callback.onAdLoadFailed(BMError.requestError("title not provided")); return false; } if (TextUtils.isEmpty(callToAction)) { callback.onAdLoadFailed(BMError.requestError("callToAction not provided")); return false; } return true; } NastParams(@NonNull UnifiedMediationParams mediationParams); @Override boolean isValid(@NonNull UnifiedAdCallback callback); }
NastParams extends UnifiedParams { @Override public boolean isValid(@NonNull UnifiedAdCallback callback) { if (TextUtils.isEmpty(title)) { callback.onAdLoadFailed(BMError.requestError("title not provided")); return false; } if (TextUtils.isEmpty(callToAction)) { callback.onAdLoadFailed(BMError.requestError("callToAction not provided")); return false; } return true; } NastParams(@NonNull UnifiedMediationParams mediationParams); @Override boolean isValid(@NonNull UnifiedAdCallback callback);  }