@Test public void shouldCreateStockCardsForKitsIfNotExist() throws Exception { Product kit = new Product(); kit.setKit(true); kit.setPrimaryName("kit a"); kit.setId(123); ArrayList<Product> kits = new ArrayList<>(); kits.add(kit); when(productRepository.listActiveProducts(IsKit.Yes)).thenReturn(kits); when(stockRepository.queryStockCardByProductId(123)).thenReturn(null); TestSubscriber<List<StockCard>> subscriber = new TestSubscriber(); presenter.afterLoadHandler = subscriber; presenter.loadKits(); subscriber.awaitTerminalEvent(); verify(stockRepository).createOrUpdateStockCardWithStockMovement(any(StockCard.class)); StockCard createdKitStockCard = subscriber.getOnNextEvents().get(0).get(0); assertThat(createdKitStockCard.getProduct().getPrimaryName()).isEqualTo("kit a"); }
public void loadKits() { view.loading(); Subscription subscription = createOrGetKitStockCardsObservable().subscribe(afterLoadHandler); subscriptions.add(subscription); }
StockCardPresenter extends Presenter { public void loadKits() { view.loading(); Subscription subscription = createOrGetKitStockCardsObservable().subscribe(afterLoadHandler); subscriptions.add(subscription); } }
StockCardPresenter extends Presenter { public void loadKits() { view.loading(); Subscription subscription = createOrGetKitStockCardsObservable().subscribe(afterLoadHandler); subscriptions.add(subscription); } StockCardPresenter(); }
StockCardPresenter extends Presenter { public void loadKits() { view.loading(); Subscription subscription = createOrGetKitStockCardsObservable().subscribe(afterLoadHandler); subscriptions.add(subscription); } 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 loadKits() { view.loading(); Subscription subscription = createOrGetKitStockCardsObservable().subscribe(afterLoadHandler); subscriptions.add(subscription); } 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);  }