use of io.reactivex.rxjava3.subscribers.TestSubscriber in project RxJava by ReactiveX.
the class FlowableReplayTest method disposeNoNeedForResetTimeBound.
@Test
public void disposeNoNeedForResetTimeBound() {
PublishProcessor<Integer> pp = PublishProcessor.create();
ConnectableFlowable<Integer> cf = pp.replay(10, TimeUnit.MINUTES);
TestSubscriber<Integer> ts = cf.test();
Disposable d = cf.connect();
pp.onNext(1);
d.dispose();
ts = cf.test();
ts.assertEmpty();
cf.connect();
ts.assertEmpty();
pp.onNext(2);
ts.assertValuesOnly(2);
}
use of io.reactivex.rxjava3.subscribers.TestSubscriber in project RxJava by ReactiveX.
the class FlowableReplayTest method unsafeChildOnErrorThrowsSizeBound.
@Test
public void unsafeChildOnErrorThrowsSizeBound() throws Throwable {
TestHelper.withErrorTracking(errors -> {
Flowable<Integer> source = Flowable.<Integer>error(new IOException()).replay(1000).autoConnect();
TestSubscriber<Integer> ts = new TestSubscriber<Integer>() {
@Override
public void onError(Throwable t) {
super.onError(t);
throw new TestException();
}
};
source.subscribe(ts);
ts.assertFailure(IOException.class);
TestHelper.assertUndeliverable(errors, 0, TestException.class);
});
}
use of io.reactivex.rxjava3.subscribers.TestSubscriber in project RxJava by ReactiveX.
the class FlowableReplayTest method disposeNoNeedForReset.
@Test
public void disposeNoNeedForReset() {
PublishProcessor<Integer> pp = PublishProcessor.create();
ConnectableFlowable<Integer> cf = pp.replay();
TestSubscriber<Integer> ts = cf.test();
Disposable d = cf.connect();
pp.onNext(1);
d.dispose();
ts = cf.test();
ts.assertEmpty();
cf.connect();
ts.assertEmpty();
pp.onNext(2);
ts.assertValuesOnly(2);
}
use of io.reactivex.rxjava3.subscribers.TestSubscriber in project RxJava by ReactiveX.
the class FlowableReplayTest method disposeNoNeedForResetTimeAndSIzeBound.
@Test
public void disposeNoNeedForResetTimeAndSIzeBound() {
PublishProcessor<Integer> pp = PublishProcessor.create();
ConnectableFlowable<Integer> cf = pp.replay(10, 10, TimeUnit.MINUTES);
TestSubscriber<Integer> ts = cf.test();
Disposable d = cf.connect();
pp.onNext(1);
d.dispose();
ts = cf.test();
ts.assertEmpty();
cf.connect();
ts.assertEmpty();
pp.onNext(2);
ts.assertValuesOnly(2);
}
use of io.reactivex.rxjava3.subscribers.TestSubscriber in project RxJava by ReactiveX.
the class FlowableReplayTest method unsafeChildOnErrorThrows.
@Test
public void unsafeChildOnErrorThrows() throws Throwable {
TestHelper.withErrorTracking(errors -> {
Flowable<Integer> source = Flowable.<Integer>error(new IOException()).replay().autoConnect();
TestSubscriber<Integer> ts = new TestSubscriber<Integer>() {
@Override
public void onError(Throwable t) {
super.onError(t);
throw new TestException();
}
};
source.subscribe(ts);
ts.assertFailure(IOException.class);
TestHelper.assertUndeliverable(errors, 0, TestException.class);
});
}
Aggregations