use of io.reactivex.rxjava3.internal.subscriptions.BooleanSubscription in project RxJava by ReactiveX.
the class QueueDrainHelperTest method checkTerminatedDelayErrorNonEmpty.
@Test
public void checkTerminatedDelayErrorNonEmpty() {
TestSubscriber<Integer> ts = new TestSubscriber<>();
ts.onSubscribe(new BooleanSubscription());
QueueDrain<Integer, Integer> qd = new QueueDrain<Integer, Integer>() {
@Override
public boolean cancelled() {
return false;
}
@Override
public boolean done() {
return false;
}
@Override
public Throwable error() {
return null;
}
@Override
public boolean enter() {
return true;
}
@Override
public long requested() {
return 0;
}
@Override
public long produced(long n) {
return 0;
}
@Override
public int leave(int m) {
return 0;
}
@Override
public boolean accept(Subscriber<? super Integer> a, Integer v) {
return false;
}
};
SpscArrayQueue<Integer> q = new SpscArrayQueue<>(32);
QueueDrainHelper.checkTerminated(true, false, ts, true, q, qd);
ts.assertEmpty();
}
use of io.reactivex.rxjava3.internal.subscriptions.BooleanSubscription in project RxJava by ReactiveX.
the class QueueDrainHelperTest method checkTerminatedDelayErrorEmptyError.
@Test
public void checkTerminatedDelayErrorEmptyError() {
TestSubscriber<Integer> ts = new TestSubscriber<>();
ts.onSubscribe(new BooleanSubscription());
QueueDrain<Integer, Integer> qd = new QueueDrain<Integer, Integer>() {
@Override
public boolean cancelled() {
return false;
}
@Override
public boolean done() {
return false;
}
@Override
public Throwable error() {
return new TestException();
}
@Override
public boolean enter() {
return true;
}
@Override
public long requested() {
return 0;
}
@Override
public long produced(long n) {
return 0;
}
@Override
public int leave(int m) {
return 0;
}
@Override
public boolean accept(Subscriber<? super Integer> a, Integer v) {
return false;
}
};
SpscArrayQueue<Integer> q = new SpscArrayQueue<>(32);
QueueDrainHelper.checkTerminated(true, true, ts, true, q, qd);
ts.assertFailure(TestException.class);
}
use of io.reactivex.rxjava3.internal.subscriptions.BooleanSubscription in project RxJava by ReactiveX.
the class QueueDrainHelperTest method drainMaxLoopMissingBackpressure.
@Test
public void drainMaxLoopMissingBackpressure() {
TestSubscriber<Integer> ts = new TestSubscriber<>();
ts.onSubscribe(new BooleanSubscription());
QueueDrain<Integer, Integer> qd = new QueueDrain<Integer, Integer>() {
@Override
public boolean cancelled() {
return false;
}
@Override
public boolean done() {
return false;
}
@Override
public Throwable error() {
return null;
}
@Override
public boolean enter() {
return true;
}
@Override
public long requested() {
return 0;
}
@Override
public long produced(long n) {
return 0;
}
@Override
public int leave(int m) {
return 0;
}
@Override
public boolean accept(Subscriber<? super Integer> a, Integer v) {
return false;
}
};
SpscArrayQueue<Integer> q = new SpscArrayQueue<>(32);
q.offer(1);
QueueDrainHelper.drainMaxLoop(q, ts, false, null, qd);
ts.assertFailure(MissingBackpressureException.class);
}
use of io.reactivex.rxjava3.internal.subscriptions.BooleanSubscription in project RxJava by ReactiveX.
the class QueueDrainHelperTest method checkTerminatedDelayErrorEmpty.
@Test
public void checkTerminatedDelayErrorEmpty() {
TestSubscriber<Integer> ts = new TestSubscriber<>();
ts.onSubscribe(new BooleanSubscription());
QueueDrain<Integer, Integer> qd = new QueueDrain<Integer, Integer>() {
@Override
public boolean cancelled() {
return false;
}
@Override
public boolean done() {
return false;
}
@Override
public Throwable error() {
return null;
}
@Override
public boolean enter() {
return true;
}
@Override
public long requested() {
return 0;
}
@Override
public long produced(long n) {
return 0;
}
@Override
public int leave(int m) {
return 0;
}
@Override
public boolean accept(Subscriber<? super Integer> a, Integer v) {
return false;
}
};
SpscArrayQueue<Integer> q = new SpscArrayQueue<>(32);
QueueDrainHelper.checkTerminated(true, true, ts, true, q, qd);
ts.assertResult();
}
use of io.reactivex.rxjava3.internal.subscriptions.BooleanSubscription in project RxJava by ReactiveX.
the class QueueDrainHelperTest method drainMaxLoopMissingBackpressureWithResource.
@Test
public void drainMaxLoopMissingBackpressureWithResource() {
TestSubscriber<Integer> ts = new TestSubscriber<>();
ts.onSubscribe(new BooleanSubscription());
QueueDrain<Integer, Integer> qd = new QueueDrain<Integer, Integer>() {
@Override
public boolean cancelled() {
return false;
}
@Override
public boolean done() {
return false;
}
@Override
public Throwable error() {
return null;
}
@Override
public boolean enter() {
return true;
}
@Override
public long requested() {
return 0;
}
@Override
public long produced(long n) {
return 0;
}
@Override
public int leave(int m) {
return 0;
}
@Override
public boolean accept(Subscriber<? super Integer> a, Integer v) {
return false;
}
};
SpscArrayQueue<Integer> q = new SpscArrayQueue<>(32);
q.offer(1);
Disposable d = Disposable.empty();
QueueDrainHelper.drainMaxLoop(q, ts, false, d, qd);
ts.assertFailure(MissingBackpressureException.class);
assertTrue(d.isDisposed());
}
Aggregations