@Test
  public void getOrCreateNativeViewHolder_withViewHolder_shouldNotReCreateNativeViewHolder() {
    subject.renderAdView(relativeLayout, nativeResponse);
    NativeViewHolder expectedViewHolder = subject.mViewHolderMap.get(relativeLayout);
    subject.renderAdView(relativeLayout, nativeResponse);

    NativeViewHolder viewHolder = subject.mViewHolderMap.get(relativeLayout);
    assertThat(viewHolder).isEqualTo(expectedViewHolder);
  }
  @Test
  public void renderAdView_withNoViewHolder_shouldCreateNativeViewHolder() {
    subject.renderAdView(relativeLayout, nativeResponse);

    NativeViewHolder expectedViewHolder =
        NativeViewHolder.fromViewBinder(relativeLayout, viewBinder);
    NativeViewHolder viewHolder = subject.mViewHolderMap.get(relativeLayout);
    compareNativeViewHolders(expectedViewHolder, viewHolder);
  }
  @Test
  public void renderAdView_shouldReturnPopulatedView() {
    subject.renderAdView(relativeLayout, nativeResponse);

    assertThat(((TextView) relativeLayout.findViewById(titleView.getId())).getText())
        .isEqualTo("test title");
    assertThat(((TextView) relativeLayout.findViewById(textView.getId())).getText())
        .isEqualTo("test text");
    assertThat(((TextView) relativeLayout.findViewById(callToActionView.getId())).getText())
        .isEqualTo("test call to action");

    // not testing images due to testing complexity
  }
  public void renderAdView_withFailedViewBinder_shouldReturnEmptyViews() {
    viewBinder =
        new ViewBinder.Builder(relativeLayout.getId())
            .titleId(titleView.getId())
            .textId(badView.getId())
            .callToActionId(callToActionView.getId())
            .mainImageId(mainImageView.getId())
            .iconImageId(iconImageView.getId())
            .build();

    subject = new MoPubNativeAdRenderer(viewBinder);
    subject.renderAdView(relativeLayout, nativeResponse);

    assertThat(((TextView) relativeLayout.findViewById(titleView.getId())).getText()).isEqualTo("");
    assertThat(((TextView) relativeLayout.findViewById(textView.getId())).getText()).isEqualTo("");
    assertThat(((TextView) relativeLayout.findViewById(callToActionView.getId())).getText())
        .isEqualTo("");
  }
 @Test(expected = NullPointerException.class)
 public void renderAdView_withNullView_shouldThrowNPE() {
   subject.renderAdView(null, nativeResponse);
 }
 @Test(expected = NullPointerException.class)
 public void createAdView_withNullContext_shouldThrowNPE() {
   subject.createAdView(null, viewGroup);
 }
  public void renderAdView_withNullViewBinder_shouldThrowNPE() {
    subject = new MoPubNativeAdRenderer(null);

    exception.expect(NullPointerException.class);
    subject.renderAdView(relativeLayout, nativeResponse);
  }
 @Test(expected = NullPointerException.class)
 public void renderAdView_withNullNativeResponse_shouldThrowNPE() {
   subject.renderAdView(relativeLayout, null);
 }