@Test public void shouldNotShowMoveBackToStockCardButtonIfProductIsInactive() { View itemView = LayoutInflater.from(RuntimeEnvironment.application).inflate(R.layout.item_archived_drug, null, false); viewHolder = new ArchivedDrugsViewHolder(itemView); Product deactivatedProduct = new ProductBuilder().setPrimaryName("Lamivudina 300mg").setCode("08S41").setIsActive(false).setStrength("10mg").setType("VIA").build(); viewModel = new InventoryViewModelBuilder(deactivatedProduct) .setChecked(false) .setType("Embalagem") .setSOH(123L) .build(); mockedListener = mock(ArchivedDrugsViewHolder.ArchiveStockCardListener.class); viewHolder.populate(viewModel, queryKeyWord, mockedListener); assertThat(viewHolder.tvArchiveBack.getVisibility()).isEqualTo(View.GONE); }
public void populate(final InventoryViewModel inventoryViewModel, String queryKeyWord, final ArchiveStockCardListener listener) { tvProductName.setText(TextStyleUtil.getHighlightQueryKeyWord(queryKeyWord, inventoryViewModel.getStyledName())); tvProductUnit.setText(TextStyleUtil.getHighlightQueryKeyWord(queryKeyWord, inventoryViewModel.getStyledUnit())); if (!inventoryViewModel.getProduct().isActive()) { tvArchiveBack.setVisibility(View.GONE); } setActionListeners(inventoryViewModel, listener); }
ArchivedDrugsViewHolder extends BaseViewHolder { public void populate(final InventoryViewModel inventoryViewModel, String queryKeyWord, final ArchiveStockCardListener listener) { tvProductName.setText(TextStyleUtil.getHighlightQueryKeyWord(queryKeyWord, inventoryViewModel.getStyledName())); tvProductUnit.setText(TextStyleUtil.getHighlightQueryKeyWord(queryKeyWord, inventoryViewModel.getStyledUnit())); if (!inventoryViewModel.getProduct().isActive()) { tvArchiveBack.setVisibility(View.GONE); } setActionListeners(inventoryViewModel, listener); } }
ArchivedDrugsViewHolder extends BaseViewHolder { public void populate(final InventoryViewModel inventoryViewModel, String queryKeyWord, final ArchiveStockCardListener listener) { tvProductName.setText(TextStyleUtil.getHighlightQueryKeyWord(queryKeyWord, inventoryViewModel.getStyledName())); tvProductUnit.setText(TextStyleUtil.getHighlightQueryKeyWord(queryKeyWord, inventoryViewModel.getStyledUnit())); if (!inventoryViewModel.getProduct().isActive()) { tvArchiveBack.setVisibility(View.GONE); } setActionListeners(inventoryViewModel, listener); } ArchivedDrugsViewHolder(View itemView); }
ArchivedDrugsViewHolder extends BaseViewHolder { public void populate(final InventoryViewModel inventoryViewModel, String queryKeyWord, final ArchiveStockCardListener listener) { tvProductName.setText(TextStyleUtil.getHighlightQueryKeyWord(queryKeyWord, inventoryViewModel.getStyledName())); tvProductUnit.setText(TextStyleUtil.getHighlightQueryKeyWord(queryKeyWord, inventoryViewModel.getStyledUnit())); if (!inventoryViewModel.getProduct().isActive()) { tvArchiveBack.setVisibility(View.GONE); } setActionListeners(inventoryViewModel, listener); } ArchivedDrugsViewHolder(View itemView); void populate(final InventoryViewModel inventoryViewModel, String queryKeyWord, final ArchiveStockCardListener listener); }
ArchivedDrugsViewHolder extends BaseViewHolder { public void populate(final InventoryViewModel inventoryViewModel, String queryKeyWord, final ArchiveStockCardListener listener) { tvProductName.setText(TextStyleUtil.getHighlightQueryKeyWord(queryKeyWord, inventoryViewModel.getStyledName())); tvProductUnit.setText(TextStyleUtil.getHighlightQueryKeyWord(queryKeyWord, inventoryViewModel.getStyledUnit())); if (!inventoryViewModel.getProduct().isActive()) { tvArchiveBack.setVisibility(View.GONE); } setActionListeners(inventoryViewModel, listener); } ArchivedDrugsViewHolder(View itemView); void populate(final InventoryViewModel inventoryViewModel, String queryKeyWord, final ArchiveStockCardListener listener);  }