BulkInitialInventoryPresenter extends InventoryPresenter { @Override public Observable<List<InventoryViewModel>> loadInventory() { return Observable.create((Observable.OnSubscribe<List<InventoryViewModel>>) subscriber -> { try { List<Product> inventoryProducts = productRepository.listBasicProducts(); defaultViewModelList.clear(); inventoryViewModelList.clear(); defaultViewModelList.addAll(convertProductToStockCardViewModel(inventoryProducts, BulkInitialInventoryAdapter.ITEM_BASIC)); addHeaderForBasicProducts(); restoreDraftInventory(); subscriber.onNext(inventoryViewModelList); subscriber.onCompleted(); } catch (LMISException e) { new LMISException(e, TAG + ":" + "loadInventory").reportToFabric(); subscriber.onError(e); } }).observeOn(AndroidSchedulers.mainThread()).subscribeOn(Schedulers.io()); }  @Override Observable<List<InventoryViewModel>> loadInventory(); void addNonBasicProductsToInventory(List<Product> nonBasicProducts); List<String> getAllAddedNonBasicProduct(); void removeNonBasicProductElement(InventoryViewModel inventoryViewModel); Observable<Object> saveDraftInventoryObservable(); Observable<Object> doInventory();  }
@Test public void shouldLoadBasicProductsList() throws LMISException { when(productRepositoryMock.listBasicProducts()).thenReturn(newArrayList(basicProducts.get(1L), basicProducts.get(2L), basicProducts.get(3L), basicProducts.get(4L), basicProducts.get(5L))); TestSubscriber<List<InventoryViewModel>> subscriber = new TestSubscriber<>(); Observable<List<InventoryViewModel>> observable = bulkInitialInventoryPresenter.loadInventory(); observable.subscribe(subscriber); subscriber.awaitTerminalEvent(); subscriber.assertNoErrors(); List<InventoryViewModel> receivedInventoryViewModels = subscriber.getOnNextEvents().get(0); assertEquals(6, receivedInventoryViewModels.size()); }