use of io.reactivex.rxjava3.testsupport.SuppressUndeliverable in project RxJava by ReactiveX.
the class FutureSubscriberTest method onCompleteOnError.
@Test
@SuppressUndeliverable
public void onCompleteOnError() throws Exception {
fs.onComplete();
fs.onError(new TestException("One"));
try {
assertNull(fs.get(5, TimeUnit.MILLISECONDS));
} catch (ExecutionException ex) {
assertTrue(ex.toString(), ex.getCause() instanceof NoSuchElementException);
}
}
use of io.reactivex.rxjava3.testsupport.SuppressUndeliverable in project RxJava by ReactiveX.
the class FutureSubscriberTest method onCompleteCancelRace.
@Test
@SuppressUndeliverable
public void onCompleteCancelRace() {
for (int i = 0; i < TestHelper.RACE_DEFAULT_LOOPS; i++) {
final FutureSubscriber<Integer> fs = new FutureSubscriber<>();
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);
}
}
use of io.reactivex.rxjava3.testsupport.SuppressUndeliverable in project RxJava by ReactiveX.
the class FutureSubscriberTest method onErrorOnComplete.
@Test
@SuppressUndeliverable
public void onErrorOnComplete() throws Exception {
fs.onError(new TestException("One"));
fs.onComplete();
try {
fs.get(5, TimeUnit.MILLISECONDS);
} catch (ExecutionException ex) {
assertTrue(ex.toString(), ex.getCause() instanceof TestException);
assertEquals("One", ex.getCause().getMessage());
}
}
use of io.reactivex.rxjava3.testsupport.SuppressUndeliverable in project RxJava by ReactiveX.
the class LambdaSubscriberTest method badSourceEmitAfterDone.
@Test
@SuppressUndeliverable
public void badSourceEmitAfterDone() {
Flowable<Integer> source = Flowable.fromPublisher(new Publisher<Integer>() {
@Override
public void subscribe(Subscriber<? super Integer> s) {
BooleanSubscription s1 = new BooleanSubscription();
s.onSubscribe(s1);
s.onNext(1);
s.onComplete();
s.onNext(2);
s.onError(new TestException());
s.onComplete();
}
});
final List<Object> received = new ArrayList<>();
LambdaSubscriber<Object> subscriber = new LambdaSubscriber<>(new Consumer<Object>() {
@Override
public void accept(Object v) throws Exception {
received.add(v);
}
}, new Consumer<Throwable>() {
@Override
public void accept(Throwable e) throws Exception {
received.add(e);
}
}, new Action() {
@Override
public void run() throws Exception {
received.add(100);
}
}, new Consumer<Subscription>() {
@Override
public void accept(Subscription s) throws Exception {
s.request(Long.MAX_VALUE);
}
});
source.subscribe(subscriber);
assertEquals(Arrays.asList(1, 100), received);
}
use of io.reactivex.rxjava3.testsupport.SuppressUndeliverable in project RxJava by ReactiveX.
the class ObservableWindowWithTimeTest method overlappingOnError.
@Test
@SuppressUndeliverable
public void overlappingOnError() {
TestScheduler scheduler = new TestScheduler();
PublishSubject<Integer> ps = PublishSubject.create();
TestObserver<Integer> to = ps.window(2, 1, TimeUnit.SECONDS, scheduler).flatMap(Functions.<Observable<Integer>>identity()).test();
ps.onError(new TestException());
to.assertFailure(TestException.class);
}
Aggregations