Search in sources :

Example 1 with io.reactivex.rxjava3.observers

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

the class NotificationLiteTest method errorNotification.

@Test
public void errorNotification() {
    Object o = NotificationLite.error(new TestException());
    assertEquals("NotificationLite.Error[io.reactivex.rxjava3.exceptions.TestException]", o.toString());
    assertTrue(NotificationLite.isError(o));
    assertFalse(NotificationLite.isComplete(o));
    assertFalse(NotificationLite.isDisposable(o));
    assertFalse(NotificationLite.isSubscription(o));
    assertTrue(NotificationLite.getError(o) instanceof TestException);
}
Also used : TestException(io.reactivex.rxjava3.exceptions.TestException) RxJavaTest(io.reactivex.rxjava3.core.RxJavaTest) Test(org.junit.Test)

Example 2 with io.reactivex.rxjava3.observers

use of io.reactivex.rxjava3.observers 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);
}
Also used : TestException(io.reactivex.rxjava3.exceptions.TestException) Test(org.junit.Test)

Example 3 with io.reactivex.rxjava3.observers

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

the class SingleTakeUntilTest method untilSingleOtherError.

@Test
public void untilSingleOtherError() {
    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());
    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 4 with io.reactivex.rxjava3.observers

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

the class SingleTakeUntilTest method untilPublisherOtherError.

@Test
public void untilPublisherOtherError() {
    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());
    other.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 5 with io.reactivex.rxjava3.observers

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

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