@Test public void shouldReInventoryArchivedStockCard() throws LMISException { InventoryViewModel uncheckedModel = new InventoryViewModelBuilder(product) .setChecked(false) .build(); Product archivedProduct = new ProductBuilder().setPrimaryName("Archived product").setCode("BBC") .setIsArchived(true).build(); StockCard archivedStockCard = new StockCardBuilder().setStockOnHand(0).setProduct(archivedProduct).build(); InventoryViewModel archivedViewModel = new InventoryViewModelBuilder(archivedStockCard) .setChecked(true) .build(); List<InventoryViewModel> inventoryViewModelList = newArrayList(uncheckedModel, archivedViewModel); initialInventoryPresenter.getInventoryViewModelList().addAll(inventoryViewModelList); initialInventoryPresenter.getDefaultViewModelList().addAll(inventoryViewModelList); initialInventoryPresenter.initOrArchiveBackStockCards(); assertFalse(archivedStockCard.getProduct().isArchived()); verify(stockRepositoryMock, times(1)).updateStockCardWithProduct(archivedStockCard); }
void initOrArchiveBackStockCards() { defaultViewModelList.clear(); defaultViewModelList.addAll(inventoryViewModelList); for (InventoryViewModel inventoryViewModel : defaultViewModelList) { if (inventoryViewModel.isChecked()) { initOrArchiveBackStockCard(inventoryViewModel); } } }
InitialInventoryPresenter extends InventoryPresenter { void initOrArchiveBackStockCards() { defaultViewModelList.clear(); defaultViewModelList.addAll(inventoryViewModelList); for (InventoryViewModel inventoryViewModel : defaultViewModelList) { if (inventoryViewModel.isChecked()) { initOrArchiveBackStockCard(inventoryViewModel); } } } }
InitialInventoryPresenter extends InventoryPresenter { void initOrArchiveBackStockCards() { defaultViewModelList.clear(); defaultViewModelList.addAll(inventoryViewModelList); for (InventoryViewModel inventoryViewModel : defaultViewModelList) { if (inventoryViewModel.isChecked()) { initOrArchiveBackStockCard(inventoryViewModel); } } }  }
InitialInventoryPresenter extends InventoryPresenter { void initOrArchiveBackStockCards() { defaultViewModelList.clear(); defaultViewModelList.addAll(inventoryViewModelList); for (InventoryViewModel inventoryViewModel : defaultViewModelList) { if (inventoryViewModel.isChecked()) { initOrArchiveBackStockCard(inventoryViewModel); } } }  @Override Observable<List<InventoryViewModel>> loadInventory(); Observable<List<InventoryViewModel>> loadInventoryWithBasicProducts(); Observable<Object> initStockCardObservable(); void addNonBasicProductsToInventory(List<Product> nonBasicProducts); void filterViewModels(final String keyword); void removeNonBasicProductElement(InventoryViewModel model); }
InitialInventoryPresenter extends InventoryPresenter { void initOrArchiveBackStockCards() { defaultViewModelList.clear(); defaultViewModelList.addAll(inventoryViewModelList); for (InventoryViewModel inventoryViewModel : defaultViewModelList) { if (inventoryViewModel.isChecked()) { initOrArchiveBackStockCard(inventoryViewModel); } } }  @Override Observable<List<InventoryViewModel>> loadInventory(); Observable<List<InventoryViewModel>> loadInventoryWithBasicProducts(); Observable<Object> initStockCardObservable(); void addNonBasicProductsToInventory(List<Product> nonBasicProducts); void filterViewModels(final String keyword); void removeNonBasicProductElement(InventoryViewModel model); static final String EMPTY_STRING; }