Search in sources :

Example 16 with SingleSubject

use of io.reactivex.rxjava3.subjects.SingleSubject in project RxJava by ReactiveX.

the class FlowableMergeWithSingleTest method cancelOtherOnMainError.

@Test
public void cancelOtherOnMainError() {
    PublishProcessor<Integer> pp = PublishProcessor.create();
    SingleSubject<Integer> ss = SingleSubject.create();
    TestSubscriber<Integer> ts = pp.mergeWith(ss).test();
    assertTrue(pp.hasSubscribers());
    assertTrue(ss.hasObservers());
    pp.onError(new TestException());
    ts.assertFailure(TestException.class);
    assertFalse("main has observers!", pp.hasSubscribers());
    assertFalse("other has observers", ss.hasObservers());
}
Also used : TestException(io.reactivex.rxjava3.exceptions.TestException) Test(org.junit.Test)

Example 17 with SingleSubject

use of io.reactivex.rxjava3.subjects.SingleSubject in project RxJava by ReactiveX.

the class FlowableMergeWithSingleTest method cancelMainOnOtherError.

@Test
public void cancelMainOnOtherError() {
    PublishProcessor<Integer> pp = PublishProcessor.create();
    SingleSubject<Integer> ss = SingleSubject.create();
    TestSubscriber<Integer> ts = pp.mergeWith(ss).test();
    assertTrue(pp.hasSubscribers());
    assertTrue(ss.hasObservers());
    ss.onError(new TestException());
    ts.assertFailure(TestException.class);
    assertFalse("main has observers!", pp.hasSubscribers());
    assertFalse("other has observers", ss.hasObservers());
}
Also used : TestException(io.reactivex.rxjava3.exceptions.TestException) Test(org.junit.Test)

Example 18 with SingleSubject

use of io.reactivex.rxjava3.subjects.SingleSubject in project RxJava by ReactiveX.

the class SingleFlatMapObservableTest method errorMain.

@Test
public void errorMain() {
    SingleSubject<Integer> ss = SingleSubject.create();
    PublishSubject<Integer> ps = PublishSubject.create();
    TestObserver<Integer> to = ss.flatMapObservable(Functions.justFunction(ps)).test();
    assertTrue(ss.hasObservers());
    assertFalse(ps.hasObservers());
    ss.onError(new TestException());
    assertFalse(ss.hasObservers());
    assertFalse(ps.hasObservers());
    to.assertFailure(TestException.class);
}
Also used : TestException(io.reactivex.rxjava3.exceptions.TestException) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)18 TestException (io.reactivex.rxjava3.exceptions.TestException)15 TestScheduler (io.reactivex.rxjava3.schedulers.TestScheduler)4