use of io.reactivex.internal.subscribers.FutureSubscriber in project RxJava by ReactiveX.
the class FutureObserverTest method onErrorCancelRace.
@Test
public void onErrorCancelRace() {
RxJavaPlugins.setErrorHandler(Functions.emptyConsumer());
try {
for (int i = 0; i < 500; i++) {
final FutureSubscriber<Integer> fo = new FutureSubscriber<Integer>();
final TestException ex = new TestException();
Runnable r1 = new Runnable() {
@Override
public void run() {
fo.cancel(false);
}
};
Runnable r2 = new Runnable() {
@Override
public void run() {
fo.onError(ex);
}
};
TestHelper.race(r1, r2, Schedulers.single());
}
} finally {
RxJavaPlugins.reset();
}
}
use of io.reactivex.internal.subscribers.FutureSubscriber in project RxJava by ReactiveX.
the class FutureObserverTest method onCompleteCancelRace.
@Test
public void onCompleteCancelRace() {
for (int i = 0; i < 500; i++) {
final FutureSubscriber<Integer> fo = new FutureSubscriber<Integer>();
if (i % 3 == 0) {
fo.onSubscribe(new BooleanSubscription());
}
if (i % 2 == 0) {
fo.onNext(1);
}
Runnable r1 = new Runnable() {
@Override
public void run() {
fo.cancel(false);
}
};
Runnable r2 = new Runnable() {
@Override
public void run() {
fo.onComplete();
}
};
TestHelper.race(r1, r2, Schedulers.single());
}
}
use of io.reactivex.internal.subscribers.FutureSubscriber in project RxJava by ReactiveX.
the class FutureSubscriberTest method onErrorCancelRace.
@Test
public void onErrorCancelRace() {
for (int i = 0; i < 500; i++) {
final FutureSubscriber<Integer> fs = new FutureSubscriber<Integer>();
final TestException ex = new TestException();
Runnable r1 = new Runnable() {
@Override
public void run() {
fs.cancel(false);
}
};
Runnable r2 = new Runnable() {
@Override
public void run() {
fs.onError(ex);
}
};
TestHelper.race(r1, r2, Schedulers.single());
}
}
use of io.reactivex.internal.subscribers.FutureSubscriber in project RxJava by ReactiveX.
the class FutureSubscriberTest method onCompleteCancelRace.
@Test
public void onCompleteCancelRace() {
for (int i = 0; i < 500; i++) {
final FutureSubscriber<Integer> fs = new FutureSubscriber<Integer>();
if (i % 3 == 0) {
fs.onSubscribe(new BooleanSubscription());
}
if (i % 2 == 0) {
fs.onNext(1);
}
Runnable r1 = new Runnable() {
@Override
public void run() {
fs.cancel(false);
}
};
Runnable r2 = new Runnable() {
@Override
public void run() {
fs.onComplete();
}
};
TestHelper.race(r1, r2, Schedulers.single());
}
}
Aggregations