@Test public void shouldUpdateStockCardExpiryDateAndProduct() throws Exception { StockCard stockCard = stockCard(false, true, false, 0); stockCard.setExpireDates("01/01/2016"); presenter.archiveBackStockCard(stockCard); verify(stockRepository).updateStockCardWithProduct(stockCard); verify(stockRepository, never()).updateProductOfStockCard(stockCard.getProduct()); assertThat(stockCard.getExpireDates()).isEqualTo(""); assertFalse(stockCard.getProduct().isArchived()); }
public void archiveBackStockCard(StockCard stockCard) { stockCard.getProduct().setArchived(false); stockCard.setExpireDates(""); try { stockRepository.updateStockCardWithProduct(stockCard); } catch (LMISException e) { new LMISException(e, "StockCardPresenter.archiveBackStockCard").reportToFabric(); } }
StockCardPresenter extends Presenter { public void archiveBackStockCard(StockCard stockCard) { stockCard.getProduct().setArchived(false); stockCard.setExpireDates(""); try { stockRepository.updateStockCardWithProduct(stockCard); } catch (LMISException e) { new LMISException(e, "StockCardPresenter.archiveBackStockCard").reportToFabric(); } } }
StockCardPresenter extends Presenter { public void archiveBackStockCard(StockCard stockCard) { stockCard.getProduct().setArchived(false); stockCard.setExpireDates(""); try { stockRepository.updateStockCardWithProduct(stockCard); } catch (LMISException e) { new LMISException(e, "StockCardPresenter.archiveBackStockCard").reportToFabric(); } } StockCardPresenter(); }
StockCardPresenter extends Presenter { public void archiveBackStockCard(StockCard stockCard) { stockCard.getProduct().setArchived(false); stockCard.setExpireDates(""); try { stockRepository.updateStockCardWithProduct(stockCard); } catch (LMISException e) { new LMISException(e, "StockCardPresenter.archiveBackStockCard").reportToFabric(); } } StockCardPresenter(); List<InventoryViewModel> getInventoryViewModels(); Observable<List<StockCard>> correctDirtyObservable(ArchiveStatus status); void loadStockCards(ArchiveStatus status); void loadStockCards(ArchiveStatus status, Boolean showLoading); void loadKits(); void refreshStockCardsObservable(long stockCardId); @Override void attachView(BaseView v); void archiveBackStockCard(StockCard stockCard); }
StockCardPresenter extends Presenter { public void archiveBackStockCard(StockCard stockCard) { stockCard.getProduct().setArchived(false); stockCard.setExpireDates(""); try { stockRepository.updateStockCardWithProduct(stockCard); } catch (LMISException e) { new LMISException(e, "StockCardPresenter.archiveBackStockCard").reportToFabric(); } } StockCardPresenter(); List<InventoryViewModel> getInventoryViewModels(); Observable<List<StockCard>> correctDirtyObservable(ArchiveStatus status); void loadStockCards(ArchiveStatus status); void loadStockCards(ArchiveStatus status, Boolean showLoading); void loadKits(); void refreshStockCardsObservable(long stockCardId); @Override void attachView(BaseView v); void archiveBackStockCard(StockCard stockCard);  }