Search in sources :

Example 21 with io.reactivex.rxjava3.observers

use of io.reactivex.rxjava3.observers in project RxJava by ReactiveX.

the class SingleTakeUntilTest method untilPublisherMainError.

@Test
public void untilPublisherMainError() {
    SingleSubject<Integer> main = SingleSubject.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)

Example 22 with io.reactivex.rxjava3.observers

use of io.reactivex.rxjava3.observers in project RxJava by ReactiveX.

the class SingleTakeUntilTest method untilCompletableMainError.

@Test
public void untilCompletableMainError() {
    SingleSubject<Integer> main = SingleSubject.create();
    CompletableSubject other = CompletableSubject.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 23 with io.reactivex.rxjava3.observers

use of io.reactivex.rxjava3.observers in project RxJava by ReactiveX.

the class SingleTakeUntilTest method untilCompletableOtherError.

@Test
public void untilCompletableOtherError() {
    SingleSubject<Integer> main = SingleSubject.create();
    CompletableSubject other = CompletableSubject.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 24 with io.reactivex.rxjava3.observers

use of io.reactivex.rxjava3.observers 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 25 with io.reactivex.rxjava3.observers

use of io.reactivex.rxjava3.observers 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)

Aggregations

Test (org.junit.Test)34 TestException (io.reactivex.rxjava3.exceptions.TestException)30 RxMethod (io.reactivex.rxjava3.validators.BaseTypeParser.RxMethod)6 Observable (io.reactivex.rxjava3.core.Observable)2 CompletableSubject (io.reactivex.rxjava3.subjects.CompletableSubject)2 IOException (java.io.IOException)2 Pattern (java.util.regex.Pattern)2 RxJavaTest (io.reactivex.rxjava3.core.RxJavaTest)1 ConnectConsumer (io.reactivex.rxjava3.internal.util.ConnectConsumer)1