use of io.reactivex.rxjava3.core.Completable in project redisson by redisson.
the class RedissonBatchRxTest method testConvertor.
@ParameterizedTest
@MethodSource("data")
public void testConvertor(BatchOptions batchOptions) {
RBatchRx batch = redisson.createBatch(batchOptions);
Single<Double> f1 = batch.getScoredSortedSet("myZKey").addScore("abc", 1d);
Completable f2 = batch.getBucket("test").set("1");
sync(batch.execute());
assertThat(sync(f1)).isEqualTo(1d);
sync(f2);
RScoredSortedSetRx<String> set = redisson.getScoredSortedSet("myZKey");
assertThat(sync(set.getScore("abc"))).isEqualTo(1d);
RBucketRx<String> bucket = redisson.getBucket("test");
assertThat(sync(bucket.get())).isEqualTo("1");
RBatchRx batch2 = redisson.createBatch(batchOptions);
Single<Double> b2f1 = batch2.getScoredSortedSet("myZKey2").addScore("abc", 1d);
Single<Double> b2f2 = batch2.getScoredSortedSet("myZKey2").addScore("abc", 1d);
sync(batch2.execute());
assertThat(sync(b2f1)).isEqualTo(1d);
assertThat(sync(b2f2)).isEqualTo(2d);
}
use of io.reactivex.rxjava3.core.Completable in project RxJava by ReactiveX.
the class CompletableCacheTest method error.
@Test
public void error() {
Completable c = Completable.error(new TestException()).doOnSubscribe(this).cache();
assertEquals(0, count);
c.test().assertFailure(TestException.class);
assertEquals(1, count);
c.test().assertFailure(TestException.class);
assertEquals(1, count);
c.test().assertFailure(TestException.class);
assertEquals(1, count);
}
use of io.reactivex.rxjava3.core.Completable in project RxJava by ReactiveX.
the class CompletableCacheTest method crossDisposeOnError.
@Test
public void crossDisposeOnError() {
PublishSubject<Integer> ps = PublishSubject.create();
final TestObserver<Void> to1 = new TestObserver<>();
final TestObserver<Void> to2 = new TestObserver<Void>() {
@Override
public void onError(Throwable ex) {
super.onError(ex);
to1.dispose();
}
};
Completable c = ps.ignoreElements().cache();
c.subscribe(to2);
c.subscribe(to1);
ps.onError(new TestException());
to1.assertEmpty();
to2.assertFailure(TestException.class);
}
use of io.reactivex.rxjava3.core.Completable in project RxJava by ReactiveX.
the class SingleConcatMapCompletableTest method mapperThrows.
@Test
public void mapperThrows() {
final boolean[] b = { false };
Single.just(1).concatMapCompletable(new Function<Integer, Completable>() {
@Override
public Completable apply(Integer t) throws Exception {
throw new TestException();
}
}).test().assertFailure(TestException.class);
assertFalse(b[0]);
}
use of io.reactivex.rxjava3.core.Completable in project RxJava by ReactiveX.
the class SingleFlatMapTest method mapperThrows.
@Test
public void mapperThrows() {
final boolean[] b = { false };
Single.just(1).flatMapCompletable(new Function<Integer, Completable>() {
@Override
public Completable apply(Integer t) throws Exception {
throw new TestException();
}
}).test().assertFailure(TestException.class);
assertFalse(b[0]);
}
Aggregations