@Test public void shouldInitStockCardAndCreateAInitInventoryMovementItem() throws LMISException { StockCard stockcard = new StockCard(); stockcard.setProduct(product); InventoryViewModel model = new InventoryViewModelBuilder(stockcard).setChecked(true).build(); InventoryViewModel model2 = new InventoryViewModelBuilder(product).setChecked(true).build(); model2.getNewLotMovementViewModelList().add(new LotMovementViewModelBuilder().setExpiryDate("Jan 2016").setQuantity("20").build()); model.getNewLotMovementViewModelList().add(new LotMovementViewModelBuilder().setExpiryDate("Feb 2015").setQuantity("2020").build()); model.getProduct().setArchived(true); initialInventoryPresenter.getInventoryViewModelList().add(model); initialInventoryPresenter.getInventoryViewModelList().add(model2); initialInventoryPresenter.getDefaultViewModelList().add(model); initialInventoryPresenter.getDefaultViewModelList().add(model2); initialInventoryPresenter.initOrArchiveBackStockCards(); verify(stockRepositoryMock, times(1)).updateStockCardWithProduct(any(StockCard.class)); verify(stockRepositoryMock, times(1)).addStockMovementAndUpdateStockCard(any(StockMovementItem.class)); }
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; }