@Test public void getSumByReimbursementNormal() { entries = new ArrayList<>(); entries.add(new LabeledGraphEntry(15, context.getString(R.string.graphs_label_non_reimbursable))); entries.add(new LabeledGraphEntry(5, context.getString(R.string.graphs_label_reimbursable))); when(groupingController.getSummationByReimbursementAsGraphEntries(trip)).thenReturn(Single.just(entries)); List<LabeledGraphEntry> sortedEntries = new ArrayList<>(entries); Collections.sort(sortedEntries); interactor.getSummationByReimbursement(trip) .test() .assertNoErrors() .assertComplete() .assertResult(GraphUiIndicator.summationByReimbursement(sortedEntries)); }
public Maybe<GraphUiIndicator> getSummationByReimbursement(Trip trip) { return groupingController.getSummationByReimbursementAsGraphEntries(trip) .filter(graphEntries -> graphEntries.size() == 2) .map(GraphUiIndicator::summationByReimbursement) .observeOn(AndroidSchedulers.mainThread()); }
GraphsInteractor { public Maybe<GraphUiIndicator> getSummationByReimbursement(Trip trip) { return groupingController.getSummationByReimbursementAsGraphEntries(trip) .filter(graphEntries -> graphEntries.size() == 2) .map(GraphUiIndicator::summationByReimbursement) .observeOn(AndroidSchedulers.mainThread()); } }
GraphsInteractor { public Maybe<GraphUiIndicator> getSummationByReimbursement(Trip trip) { return groupingController.getSummationByReimbursementAsGraphEntries(trip) .filter(graphEntries -> graphEntries.size() == 2) .map(GraphUiIndicator::summationByReimbursement) .observeOn(AndroidSchedulers.mainThread()); } @Inject  GraphsInteractor(Context context, GroupingController groupingController); }
GraphsInteractor { public Maybe<GraphUiIndicator> getSummationByReimbursement(Trip trip) { return groupingController.getSummationByReimbursementAsGraphEntries(trip) .filter(graphEntries -> graphEntries.size() == 2) .map(GraphUiIndicator::summationByReimbursement) .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> getSummationByReimbursement(Trip trip) { return groupingController.getSummationByReimbursementAsGraphEntries(trip) .filter(graphEntries -> graphEntries.size() == 2) .map(GraphUiIndicator::summationByReimbursement) .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; }