use of io.requery.reactivex.ReactiveResult in project requery by requery.
the class ReactiveTest method testQuerySelfObservableMap.
@Test
public void testQuerySelfObservableMap() throws Exception {
final AtomicInteger count = new AtomicInteger();
Disposable disposable = data.select(Person.class).limit(2).get().observableResult().flatMap(new Function<ReactiveResult<Person>, Observable<Person>>() {
@Override
public Observable<Person> apply(ReactiveResult<Person> persons) {
return persons.observable();
}
}).subscribe(new Consumer<Person>() {
@Override
public void accept(Person persons) {
count.incrementAndGet();
}
});
data.insert(randomPerson()).blockingGet();
data.insert(randomPerson()).blockingGet();
assertEquals(3, count.get());
disposable.dispose();
}
Aggregations