use of io.reactivex.rxjava3.processors.ReplayProcessor in project RxJava by ReactiveX.
the class ReplayProcessorTest method timeBoundZeroRequestError.
@Test
public void timeBoundZeroRequestError() {
final ReplayProcessor<Integer> source = ReplayProcessor.createWithTime(1, TimeUnit.MINUTES, Schedulers.single());
source.onError(new TestException());
source.test(0).assertFailure(TestException.class);
}
use of io.reactivex.rxjava3.processors.ReplayProcessor in project RxJava by ReactiveX.
the class ReplayProcessorTest method currentStateMethodsError.
@Test
public void currentStateMethodsError() {
ReplayProcessor<Object> as = ReplayProcessor.create();
assertFalse(as.hasThrowable());
assertFalse(as.hasComplete());
assertNull(as.getThrowable());
as.onError(new TestException());
assertTrue(as.hasThrowable());
assertFalse(as.hasComplete());
assertTrue(as.getThrowable() instanceof TestException);
}
use of io.reactivex.rxjava3.processors.ReplayProcessor in project RxJava by ReactiveX.
the class ReplayProcessorTest method noHeadRetentionErrorSize.
@Test
public void noHeadRetentionErrorSize() {
ReplayProcessor<Integer> source = ReplayProcessor.createWithSize(1);
source.onNext(1);
source.onNext(2);
source.onError(new TestException());
SizeBoundReplayBuffer<Integer> buf = (SizeBoundReplayBuffer<Integer>) source.buffer;
assertNull(buf.head.value);
Object o = buf.head;
source.cleanupBuffer();
assertSame(o, buf.head);
}
use of io.reactivex.rxjava3.processors.ReplayProcessor in project RxJava by ReactiveX.
the class ReplayProcessorTest method sizeAndHasAnyValueEffectivelyUnboundedError.
@Test
public void sizeAndHasAnyValueEffectivelyUnboundedError() {
ReplayProcessor<Object> rs = ReplayProcessor.createUnbounded();
assertEquals(0, rs.size());
assertFalse(rs.hasValue());
rs.onNext(1);
assertEquals(1, rs.size());
assertTrue(rs.hasValue());
rs.onNext(1);
assertEquals(2, rs.size());
assertTrue(rs.hasValue());
rs.onError(new TestException());
assertEquals(2, rs.size());
assertTrue(rs.hasValue());
}
use of io.reactivex.rxjava3.processors.ReplayProcessor in project RxJava by ReactiveX.
the class ReplayProcessorTest method sizeAndHasAnyValueEffectivelyUnboundedEmptyError.
@Test
public void sizeAndHasAnyValueEffectivelyUnboundedEmptyError() {
ReplayProcessor<Object> rs = ReplayProcessor.createUnbounded();
rs.onError(new TestException());
assertEquals(0, rs.size());
assertFalse(rs.hasValue());
}
Aggregations