@Test public void testMultipleSingleValueEvent() { TestSubscriber<DataSnapshot> testObserver = RxFirebaseDatabase .observeMultipleSingleValueEvent(databaseReference, databaseReferenceTwo) .test(); ArgumentCaptor<ValueEventListener> argument = ArgumentCaptor.forClass(ValueEventListener.class); verify(databaseReference).addListenerForSingleValueEvent(argument.capture()); argument.getValue().onDataChange(dataSnapshot); verify(databaseReferenceTwo).addListenerForSingleValueEvent(argument.capture()); argument.getValue().onDataChange(dataSnapshotTwo); testObserver.assertNoErrors() .assertValueCount(2) .assertComplete() .dispose(); }
@NonNull public static Flowable<DataSnapshot> observeMultipleSingleValueEvent(@NonNull DatabaseReference... whereRefs) { return Maybe.merge(Flowable.fromArray(whereRefs) .map(new Function<DatabaseReference, MaybeSource<? extends DataSnapshot>>() { @Override public MaybeSource<? extends DataSnapshot> apply(@NonNull DatabaseReference databaseReference) throws Exception { return observeSingleValueEvent(databaseReference); } }) ); }
RxFirebaseDatabase { @NonNull public static Flowable<DataSnapshot> observeMultipleSingleValueEvent(@NonNull DatabaseReference... whereRefs) { return Maybe.merge(Flowable.fromArray(whereRefs) .map(new Function<DatabaseReference, MaybeSource<? extends DataSnapshot>>() { @Override public MaybeSource<? extends DataSnapshot> apply(@NonNull DatabaseReference databaseReference) throws Exception { return observeSingleValueEvent(databaseReference); } }) ); } }
RxFirebaseDatabase { @NonNull public static Flowable<DataSnapshot> observeMultipleSingleValueEvent(@NonNull DatabaseReference... whereRefs) { return Maybe.merge(Flowable.fromArray(whereRefs) .map(new Function<DatabaseReference, MaybeSource<? extends DataSnapshot>>() { @Override public MaybeSource<? extends DataSnapshot> apply(@NonNull DatabaseReference databaseReference) throws Exception { return observeSingleValueEvent(databaseReference); } }) ); }  }
RxFirebaseDatabase { @NonNull public static Flowable<DataSnapshot> observeMultipleSingleValueEvent(@NonNull DatabaseReference... whereRefs) { return Maybe.merge(Flowable.fromArray(whereRefs) .map(new Function<DatabaseReference, MaybeSource<? extends DataSnapshot>>() { @Override public MaybeSource<? extends DataSnapshot> apply(@NonNull DatabaseReference databaseReference) throws Exception { return observeSingleValueEvent(databaseReference); } }) ); }  @NonNull static Flowable<DataSnapshot> observeValueEvent(@NonNull final Query query,
                                                           @NonNull BackpressureStrategy strategy); @NonNull static Maybe<DataSnapshot> observeSingleValueEvent(@NonNull final Query query); @NonNull static Single<DataSnapshot> runTransaction(@NonNull final DatabaseReference ref,
                                                      @NonNull final boolean fireLocalEvents,
                                                      @NonNull final long transactionValue); @NonNull static Completable setValue(@NonNull final DatabaseReference ref,
                                       final Object value); @NonNull static Completable updateChildren(@NonNull final DatabaseReference ref,
                                             @NonNull final Map<String, Object> updateData); @NonNull static Flowable<RxFirebaseChildEvent<DataSnapshot>> observeChildEvent(
        @NonNull final Query query, @NonNull BackpressureStrategy strategy); @NonNull static Flowable<DataSnapshot> observeMultipleSingleValueEvent(@NonNull DatabaseReference... whereRefs); @NonNull static Maybe<DatabaseReference[]> requestFilteredReferenceKeys(@NonNull final DatabaseReference from,
                                                                          @NonNull Query whereRef); @NonNull static Flowable<T> observeValueEvent(@NonNull final Query query,
                                                    @NonNull final Class<T> clazz,
                                                    @NonNull BackpressureStrategy strategy); @NonNull static Maybe<T> observeSingleValueEvent(@NonNull final Query query,
                                                       @NonNull final Class<T> clazz); @NonNull static Flowable<RxFirebaseChildEvent<T>> observeChildEvent(
        @NonNull final Query query, @NonNull final Class<T> clazz,
        @NonNull BackpressureStrategy strategy); @NonNull static Flowable<T> observeValueEvent(@NonNull final Query query,
                                                    @NonNull final Function<? super DataSnapshot, ? extends T> mapper,
                                                    @NonNull BackpressureStrategy strategy); @NonNull static Maybe<T> observeSingleValueEvent(@NonNull final Query query,
                                                       @NonNull final Function<? super DataSnapshot, ? extends T> mapper); @NonNull static Flowable<RxFirebaseChildEvent<T>> observeChildEvent(
        @NonNull final Query query, @NonNull final Function<? super RxFirebaseChildEvent<DataSnapshot>,
        ? extends RxFirebaseChildEvent<T>> mapper, @NonNull BackpressureStrategy strategy); @NonNull static Flowable<DataSnapshot> observeValueEvent(@NonNull final Query query); @NonNull static Flowable<RxFirebaseChildEvent<DataSnapshot>> observeChildEvent(
        @NonNull final Query query); @NonNull static Single<DataSnapshot> runTransaction(@NonNull final DatabaseReference ref,
                                                      @NonNull final long transactionValue); @NonNull static Flowable<T> observeValueEvent(@NonNull final Query query,
                                                    @NonNull final Class<T> clazz); @NonNull static Flowable<RxFirebaseChildEvent<T>> observeChildEvent(
        @NonNull final Query query, @NonNull final Class<T> clazz); @NonNull static Flowable<T> observeValueEvent(@NonNull final Query query,
                                                    @NonNull final Function<? super DataSnapshot, ? extends T> mapper); @NonNull static Flowable<RxFirebaseChildEvent<T>> observeChildEvent(
        @NonNull final Query query, @NonNull final Function<? super RxFirebaseChildEvent<DataSnapshot>,
        ? extends RxFirebaseChildEvent<T>> mapper); }
RxFirebaseDatabase { @NonNull public static Flowable<DataSnapshot> observeMultipleSingleValueEvent(@NonNull DatabaseReference... whereRefs) { return Maybe.merge(Flowable.fromArray(whereRefs) .map(new Function<DatabaseReference, MaybeSource<? extends DataSnapshot>>() { @Override public MaybeSource<? extends DataSnapshot> apply(@NonNull DatabaseReference databaseReference) throws Exception { return observeSingleValueEvent(databaseReference); } }) ); }  @NonNull static Flowable<DataSnapshot> observeValueEvent(@NonNull final Query query,
                                                           @NonNull BackpressureStrategy strategy); @NonNull static Maybe<DataSnapshot> observeSingleValueEvent(@NonNull final Query query); @NonNull static Single<DataSnapshot> runTransaction(@NonNull final DatabaseReference ref,
                                                      @NonNull final boolean fireLocalEvents,
                                                      @NonNull final long transactionValue); @NonNull static Completable setValue(@NonNull final DatabaseReference ref,
                                       final Object value); @NonNull static Completable updateChildren(@NonNull final DatabaseReference ref,
                                             @NonNull final Map<String, Object> updateData); @NonNull static Flowable<RxFirebaseChildEvent<DataSnapshot>> observeChildEvent(
        @NonNull final Query query, @NonNull BackpressureStrategy strategy); @NonNull static Flowable<DataSnapshot> observeMultipleSingleValueEvent(@NonNull DatabaseReference... whereRefs); @NonNull static Maybe<DatabaseReference[]> requestFilteredReferenceKeys(@NonNull final DatabaseReference from,
                                                                          @NonNull Query whereRef); @NonNull static Flowable<T> observeValueEvent(@NonNull final Query query,
                                                    @NonNull final Class<T> clazz,
                                                    @NonNull BackpressureStrategy strategy); @NonNull static Maybe<T> observeSingleValueEvent(@NonNull final Query query,
                                                       @NonNull final Class<T> clazz); @NonNull static Flowable<RxFirebaseChildEvent<T>> observeChildEvent(
        @NonNull final Query query, @NonNull final Class<T> clazz,
        @NonNull BackpressureStrategy strategy); @NonNull static Flowable<T> observeValueEvent(@NonNull final Query query,
                                                    @NonNull final Function<? super DataSnapshot, ? extends T> mapper,
                                                    @NonNull BackpressureStrategy strategy); @NonNull static Maybe<T> observeSingleValueEvent(@NonNull final Query query,
                                                       @NonNull final Function<? super DataSnapshot, ? extends T> mapper); @NonNull static Flowable<RxFirebaseChildEvent<T>> observeChildEvent(
        @NonNull final Query query, @NonNull final Function<? super RxFirebaseChildEvent<DataSnapshot>,
        ? extends RxFirebaseChildEvent<T>> mapper, @NonNull BackpressureStrategy strategy); @NonNull static Flowable<DataSnapshot> observeValueEvent(@NonNull final Query query); @NonNull static Flowable<RxFirebaseChildEvent<DataSnapshot>> observeChildEvent(
        @NonNull final Query query); @NonNull static Single<DataSnapshot> runTransaction(@NonNull final DatabaseReference ref,
                                                      @NonNull final long transactionValue); @NonNull static Flowable<T> observeValueEvent(@NonNull final Query query,
                                                    @NonNull final Class<T> clazz); @NonNull static Flowable<RxFirebaseChildEvent<T>> observeChildEvent(
        @NonNull final Query query, @NonNull final Class<T> clazz); @NonNull static Flowable<T> observeValueEvent(@NonNull final Query query,
                                                    @NonNull final Function<? super DataSnapshot, ? extends T> mapper); @NonNull static Flowable<RxFirebaseChildEvent<T>> observeChildEvent(
        @NonNull final Query query, @NonNull final Function<? super RxFirebaseChildEvent<DataSnapshot>,
        ? extends RxFirebaseChildEvent<T>> mapper);  }