use of io.reactivex.rxjava3.internal.subscriptions.BooleanSubscription in project RxJava by ReactiveX.
the class MulticastProcessorTest method refCounted2.
@Test
public void refCounted2() {
MulticastProcessor<Integer> mp = MulticastProcessor.create(16, true);
BooleanSubscription bs = new BooleanSubscription();
mp.onSubscribe(bs);
assertFalse(bs.isCancelled());
mp.test(1, true);
assertTrue(bs.isCancelled());
assertFalse(mp.hasSubscribers());
assertTrue(mp.hasComplete());
assertFalse(mp.hasThrowable());
assertNull(mp.getThrowable());
mp.test().assertResult();
}
use of io.reactivex.rxjava3.internal.subscriptions.BooleanSubscription in project RxJava by ReactiveX.
the class MulticastProcessorTest method refCounted.
@Test
public void refCounted() {
MulticastProcessor<Integer> mp = MulticastProcessor.create(true);
BooleanSubscription bs = new BooleanSubscription();
mp.onSubscribe(bs);
assertFalse(bs.isCancelled());
mp.test().cancel();
assertTrue(bs.isCancelled());
assertFalse(mp.hasSubscribers());
assertTrue(mp.hasComplete());
assertFalse(mp.hasThrowable());
assertNull(mp.getThrowable());
mp.test().assertResult();
}
use of io.reactivex.rxjava3.internal.subscriptions.BooleanSubscription in project RxJava by ReactiveX.
the class FlowableObserveOnTest method asycFusedPollThrows.
@Test
public void asycFusedPollThrows() {
new Flowable<Integer>() {
@Override
protected void subscribeActual(Subscriber<? super Integer> subscriber) {
subscriber.onSubscribe(new BooleanSubscription());
@SuppressWarnings("unchecked") BaseObserveOnSubscriber<Integer> oo = (BaseObserveOnSubscriber<Integer>) subscriber;
oo.sourceMode = QueueFuseable.ASYNC;
oo.requested.lazySet(1);
oo.queue = new SimpleQueue<Integer>() {
@Override
public boolean offer(Integer value) {
return false;
}
@Override
public boolean offer(Integer v1, Integer v2) {
return false;
}
@Nullable
@Override
public Integer poll() throws Exception {
throw new TestException();
}
@Override
public boolean isEmpty() {
return false;
}
@Override
public void clear() {
}
};
oo.clear();
oo.trySchedule();
}
}.observeOn(Schedulers.single()).test(0L).awaitDone(5, TimeUnit.SECONDS).assertFailure(TestException.class);
}
use of io.reactivex.rxjava3.internal.subscriptions.BooleanSubscription in project RxJava by ReactiveX.
the class FlowableObserveOnTest method badSource.
@Test
public void badSource() {
List<Throwable> errors = TestHelper.trackPluginErrors();
try {
TestScheduler scheduler = new TestScheduler();
TestSubscriber<Integer> ts = new Flowable<Integer>() {
@Override
protected void subscribeActual(Subscriber<? super Integer> subscriber) {
subscriber.onSubscribe(new BooleanSubscription());
subscriber.onComplete();
subscriber.onNext(1);
subscriber.onError(new TestException());
subscriber.onComplete();
}
}.observeOn(scheduler).test();
scheduler.triggerActions();
ts.assertResult();
TestHelper.assertUndeliverable(errors, 0, TestException.class);
} finally {
RxJavaPlugins.reset();
}
}
use of io.reactivex.rxjava3.internal.subscriptions.BooleanSubscription in project RxJava by ReactiveX.
the class FlowableReplayEagerTruncateTest method badSource.
@Test
public void badSource() {
List<Throwable> errors = TestHelper.trackPluginErrors();
try {
new Flowable<Integer>() {
@Override
protected void subscribeActual(Subscriber<? super Integer> subscriber) {
subscriber.onSubscribe(new BooleanSubscription());
subscriber.onError(new TestException("First"));
subscriber.onNext(1);
subscriber.onError(new TestException("Second"));
subscriber.onComplete();
}
}.replay().autoConnect().to(TestHelper.<Integer>testConsumer()).assertFailureAndMessage(TestException.class, "First");
TestHelper.assertUndeliverable(errors, 0, TestException.class, "Second");
} finally {
RxJavaPlugins.reset();
}
}
Aggregations