PhysicalInventoryPresenter extends InventoryPresenter { public int getCompleteCount() { return FluentIterable.from(inventoryViewModelList) .filter(inventoryViewModel -> ((PhysicalInventoryViewModel) inventoryViewModel).isDone()) .toList().size(); }  @Override Observable<List<InventoryViewModel>> loadInventory(); Observable<Object> saveDraftInventoryObservable(); Observable<Object> doInventory(final String sign); void updateAvgMonthlyConsumption(); int getCompleteCount();  }
@Test public void shouldGetCompleteCount() throws Exception { PhysicalInventoryViewModel inventoryViewModel = new PhysicalInventoryViewModel(stockCardWithIdThree); inventoryViewModel.setDone(true); presenter.inventoryViewModelList.add(inventoryViewModel); presenter.inventoryViewModelList.add(new PhysicalInventoryViewModel(stockCardWithIdThree)); presenter.inventoryViewModelList.add(new PhysicalInventoryViewModel(stockCardWithIdThree)); presenter.inventoryViewModelList.add(new PhysicalInventoryViewModel(stockCardWithIdThree)); assertEquals(1, presenter.getCompleteCount()); }