### Question:
SimpleCardStackAdapter extends CardStackAdapter { @Override public View getCardView(int position, CardModel model, View convertView, ViewGroup parent) { if(convertView == null) { LayoutInflater inflater = LayoutInflater.from(getContext()); convertView = inflater.inflate(R.layout.std_card_inner, parent, false); assert convertView != null; } ((ImageView) convertView.findViewById(R.id.image)).setImageDrawable(model.getCardImageDrawable()); ((TextView) convertView.findViewById(R.id.title)).setText(model.getTitle()); ((TextView) convertView.findViewById(R.id.description)).setText(model.getDescription()); return convertView; } SimpleCardStackAdapter(Context context); @Override View getCardView(int position, CardModel model, View convertView, ViewGroup parent);  }### Answer:
@Test public void testGetCardViewNullViewCheck(){ CardModel cardModel=initializeCardModel(); SimpleCardStackAdapter simpleCardStackAdapter=initializeSimpleCardStackAdapter(); View view=initializeView(); ViewGroup parent=mock(ViewGroup.class); initializeInflater(parent,view); View cardView=simpleCardStackAdapter.getCardView(1, cardModel, null, parent); assertEquals("view instances must be equal", view, cardView); }
@Test public void testGetCardView(){ ViewGroup parent=mock(ViewGroup.class); ImageView imageView=mock(ImageView.class); TextView titleTextView=mock(TextView.class); TextView descriptionTextView=mock(TextView.class); CardModel cardModel=initializeCardModel(); View convertView=initializeView(imageView, titleTextView, descriptionTextView); SimpleCardStackAdapter simpleCardStackAdapter=initializeSimpleCardStackAdapter(); simpleCardStackAdapter.getCardView(1, cardModel, convertView, parent); verify(imageView).setImageDrawable(cardModel.getCardImageDrawable()); verify(titleTextView).setText(cardModel.getTitle()); verify(descriptionTextView).setText(cardModel.getDescription()); }