TwitterStaticNativeAdRenderer implements MoPubAdRenderer<StaticNativeAd> { @Override public void renderAdView(final View view, final StaticNativeAd staticNativeAd) { update((TwitterStaticNativeAd) view, staticNativeAd); } TwitterStaticNativeAdRenderer();  TwitterStaticNativeAdRenderer(int styleResId); @Override View createAdView(final Context context, final ViewGroup parent); @Override void renderAdView(final View view, final StaticNativeAd staticNativeAd); @Override boolean supports(final BaseNativeAd nativeAd);  }
@Test(expected = NullPointerException.class) public void testRenderAdView_withNullView_shouldThrowNPE() { twitterStaticNativeAdRenderer.renderAdView(null, staticNativeAd); }
@Test(expected = NullPointerException.class) public void testRenderAdView_withNullNativeAd_shouldThrowNPE() { twitterStaticNativeAdRenderer.renderAdView(twitterStaticNativeAd, null); }
@Test public void testRenderAdView_shouldReturnPopulatedView() { when(twitterStaticNativeAd.privacyInfoView.getContext()).thenReturn(mock(Context.class)); twitterStaticNativeAdRenderer.renderAdView(twitterStaticNativeAd, staticNativeAd); verify(twitterStaticNativeAd.adTitleView).setText(TEST_TITLE); verify(twitterStaticNativeAd.adTextView).setText(TEST_TEXT); verify(twitterStaticNativeAd.callToActionView).setText(TEST_CTA); verify(twitterStaticNativeAd.mainImageView).setImageBitmap(mockBitmap); verify(twitterStaticNativeAd.adIconView).setImageBitmap(mockBitmap); verify(twitterStaticNativeAd.privacyInfoView).setImageBitmap(mockBitmap); verify(twitterStaticNativeAd.privacyInfoView) .setOnClickListener(any(View.OnClickListener.class)); }