StockCardViewHolder extends BaseViewHolder { protected void inflateData(InventoryViewModel inventoryViewModel, String queryKeyWord) { tvStockOnHand.setText(inventoryViewModel.getStockOnHand() + ""); tvProductName.setText(TextStyleUtil.getHighlightQueryKeyWord(queryKeyWord, inventoryViewModel.getStyledName())); tvProductUnit.setText(TextStyleUtil.getHighlightQueryKeyWord(queryKeyWord, inventoryViewModel.getStyledUnit())); initExpiryDateWarning(inventoryViewModel); initStockOnHandWarning(inventoryViewModel); } StockCardViewHolder(View itemView, OnItemViewClickListener listener); void populate(final InventoryViewModel inventoryViewModel, String queryKeyWord);  }
@Test public void shouldNotShowExpiryDateWarningWhenStockOnHandIsZero() { Date mockCurrentDate = DateUtil.parseString("16/02/2016", DateUtil.SIMPLE_DATE_FORMAT); LMISTestApp.getInstance().setCurrentTimeMillis(mockCurrentDate.getTime()); StockCard stockCard = StockCardBuilder.buildStockCard(); stockCard.setStockOnHand(0); InventoryViewModel inventoryViewModel = new InventoryViewModel(stockCard); viewHolder.inflateData(inventoryViewModel, ""); assertThat(viewHolder.lyExpiryDateWarning.getVisibility()).isEqualTo(View.GONE); }