Search in sources :

Example 1 with MaybeSubject

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

the class FlowableMergeWithMaybeTest method cancelMainOnOtherError.

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

Example 2 with MaybeSubject

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

the class ObservableMergeWithMaybeTest method cancelMainOnOtherError.

@Test
public void cancelMainOnOtherError() {
    PublishSubject<Integer> ps = PublishSubject.create();
    MaybeSubject<Integer> ms = MaybeSubject.create();
    TestObserver<Integer> to = ps.mergeWith(ms).test();
    assertTrue(ps.hasObservers());
    assertTrue(ms.hasObservers());
    ms.onError(new TestException());
    to.assertFailure(TestException.class);
    assertFalse("main has observers!", ps.hasObservers());
    assertFalse("other has observers", ms.hasObservers());
}
Also used : TestException(io.reactivex.rxjava3.exceptions.TestException) Test(org.junit.Test)

Example 3 with MaybeSubject

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

the class MaybeTakeUntilTest method untilMaybeMainError.

@Test
public void untilMaybeMainError() {
    MaybeSubject<Integer> main = MaybeSubject.create();
    MaybeSubject<Integer> other = MaybeSubject.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);
}
Also used : TestException(io.reactivex.rxjava3.exceptions.TestException) Test(org.junit.Test)

Example 4 with MaybeSubject

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

the class MaybeTakeUntilTest method untilMaybeOtherError.

@Test
public void untilMaybeOtherError() {
    MaybeSubject<Integer> main = MaybeSubject.create();
    MaybeSubject<Integer> other = MaybeSubject.create();
    TestObserver<Integer> to = main.takeUntil(other).test();
    assertTrue("Main no observers?", main.hasObservers());
    assertTrue("Other no observers?", other.hasObservers());
    other.onError(new TestException());
    assertFalse("Main has observers?", main.hasObservers());
    assertFalse("Other has observers?", other.hasObservers());
    to.assertFailure(TestException.class);
}
Also used : TestException(io.reactivex.rxjava3.exceptions.TestException) Test(org.junit.Test)

Example 5 with MaybeSubject

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

the class MaybeTakeUntilTest method untilPublisherMainError.

@Test
public void untilPublisherMainError() {
    MaybeSubject<Integer> main = MaybeSubject.create();
    PublishProcessor<Integer> other = PublishProcessor.create();
    TestObserver<Integer> to = main.takeUntil(other).test();
    assertTrue("Main no observers?", main.hasObservers());
    assertTrue("Other no observers?", other.hasSubscribers());
    main.onError(new TestException());
    assertFalse("Main has observers?", main.hasObservers());
    assertFalse("Other has observers?", other.hasSubscribers());
    to.assertFailure(TestException.class);
}
Also used : TestException(io.reactivex.rxjava3.exceptions.TestException) Test(org.junit.Test)

Aggregations

TestException (io.reactivex.rxjava3.exceptions.TestException)10 Test (org.junit.Test)10