@Test public void getSumByCategoryNormal() { entries = new ArrayList<>(); entries.add(new LabeledGraphEntry(10, LABEL_1)); entries.add(new LabeledGraphEntry(9, LABEL_2)); entries.add(new LabeledGraphEntry(18, LABEL_3)); entries.add(new LabeledGraphEntry(7, LABEL_4)); entries.add(new LabeledGraphEntry(6, LABEL_5)); entries.add(new LabeledGraphEntry(3, LABEL_6)); when(groupingController.getSummationByCategoryAsGraphEntries(trip)).thenReturn(Single.just(entries)); interactor.getSummationByCategories(trip) .test() .assertNoErrors() .assertComplete() .assertValue(graphUiIndicator -> { if (graphUiIndicator.getGraphType() == GraphUiIndicator.GraphType.SummationByCategory) { List<? extends BaseEntry> graphUiIndicatorEntries = graphUiIndicator.getEntries(); return graphUiIndicatorEntries.containsAll(entries) && graphUiIndicatorEntries.size() == entries.size(); } return false; }); }
public Maybe<GraphUiIndicator> getSummationByCategories(Trip trip) { return groupingController.getSummationByCategoryAsGraphEntries(trip) .filter(graphEntries -> !graphEntries.isEmpty()) .flatMapSingleElement(Single::just) .map(GraphUiIndicator::summationByCategory) .observeOn(AndroidSchedulers.mainThread()); }
GraphsInteractor { public Maybe<GraphUiIndicator> getSummationByCategories(Trip trip) { return groupingController.getSummationByCategoryAsGraphEntries(trip) .filter(graphEntries -> !graphEntries.isEmpty()) .flatMapSingleElement(Single::just) .map(GraphUiIndicator::summationByCategory) .observeOn(AndroidSchedulers.mainThread()); } }
GraphsInteractor { public Maybe<GraphUiIndicator> getSummationByCategories(Trip trip) { return groupingController.getSummationByCategoryAsGraphEntries(trip) .filter(graphEntries -> !graphEntries.isEmpty()) .flatMapSingleElement(Single::just) .map(GraphUiIndicator::summationByCategory) .observeOn(AndroidSchedulers.mainThread()); } @Inject  GraphsInteractor(Context context, GroupingController groupingController); }
GraphsInteractor { public Maybe<GraphUiIndicator> getSummationByCategories(Trip trip) { return groupingController.getSummationByCategoryAsGraphEntries(trip) .filter(graphEntries -> !graphEntries.isEmpty()) .flatMapSingleElement(Single::just) .map(GraphUiIndicator::summationByCategory) .observeOn(AndroidSchedulers.mainThread()); } @Inject  GraphsInteractor(Context context, GroupingController groupingController); Maybe<GraphUiIndicator> getSummationByCategories(Trip trip); Maybe<GraphUiIndicator> getSummationByReimbursement(Trip trip); Maybe<GraphUiIndicator> getSummationByPaymentMethod(Trip trip); Maybe<GraphUiIndicator> getSummationByDate(Trip trip); }
GraphsInteractor { public Maybe<GraphUiIndicator> getSummationByCategories(Trip trip) { return groupingController.getSummationByCategoryAsGraphEntries(trip) .filter(graphEntries -> !graphEntries.isEmpty()) .flatMapSingleElement(Single::just) .map(GraphUiIndicator::summationByCategory) .observeOn(AndroidSchedulers.mainThread()); } @Inject  GraphsInteractor(Context context, GroupingController groupingController); Maybe<GraphUiIndicator> getSummationByCategories(Trip trip); Maybe<GraphUiIndicator> getSummationByReimbursement(Trip trip); Maybe<GraphUiIndicator> getSummationByPaymentMethod(Trip trip); Maybe<GraphUiIndicator> getSummationByDate(Trip trip); final static int PAYMENT_METHODS_MAX_COUNT; }