use of io.reactivex.rxjava3.observers.TestObserver in project RxJava by ReactiveX.
the class MaybeDelayTest method disposeDuringDelay.
@Test
public void disposeDuringDelay() {
TestScheduler scheduler = new TestScheduler();
TestObserver<Integer> to = Maybe.just(1).delay(100, TimeUnit.MILLISECONDS, scheduler).test();
to.dispose();
scheduler.advanceTimeBy(1, TimeUnit.SECONDS);
to.assertEmpty();
}
use of io.reactivex.rxjava3.observers.TestObserver in project RxJava by ReactiveX.
the class SingleTakeUntilTest method mainErrorSingle.
@Test
public void mainErrorSingle() {
PublishProcessor<Integer> pp = PublishProcessor.create();
PublishProcessor<Integer> source = PublishProcessor.create();
TestObserver<Integer> to = source.single(-99).takeUntil(pp.single(-99)).test();
source.onError(new TestException());
to.assertFailure(TestException.class);
}
use of io.reactivex.rxjava3.observers.TestObserver in project RxJava by ReactiveX.
the class SingleTakeUntilTest method mainErrorPublisher.
@Test
public void mainErrorPublisher() {
PublishProcessor<Integer> pp = PublishProcessor.create();
PublishProcessor<Integer> source = PublishProcessor.create();
TestObserver<Integer> to = source.single(-99).takeUntil(pp).test();
source.onError(new TestException());
to.assertFailure(TestException.class);
}
use of io.reactivex.rxjava3.observers.TestObserver in project RxJava by ReactiveX.
the class SingleTakeUntilTest method mainErrorCompletable.
@Test
public void mainErrorCompletable() {
PublishProcessor<Integer> pp = PublishProcessor.create();
PublishProcessor<Integer> source = PublishProcessor.create();
TestObserver<Integer> to = source.single(-99).takeUntil(pp.ignoreElements()).test();
source.onError(new TestException());
to.assertFailure(TestException.class);
}
use of io.reactivex.rxjava3.observers.TestObserver in project RxJava by ReactiveX.
the class SingleTakeUntilTest method untilSingleMainError.
@Test
public void untilSingleMainError() {
SingleSubject<Integer> main = SingleSubject.create();
SingleSubject<Integer> other = SingleSubject.create();
TestObserver<Integer> to = main.takeUntil(other).test();
assertTrue("Main no observers?", main.hasObservers());
assertTrue("Other no observers?", other.hasObservers());
main.onError(new TestException());
assertFalse("Main has observers?", main.hasObservers());
assertFalse("Other has observers?", other.hasObservers());
to.assertFailure(TestException.class);
}
Aggregations