use of io.reactivex.rxjava3.subjects.CompletableSubject in project RxJava by ReactiveX.
the class CompletableDoOnLifecycleTest method onDisposeCrash.
@Test
public void onDisposeCrash() throws Throwable {
TestHelper.withErrorTracking(errors -> {
@SuppressWarnings("unchecked") Consumer<? super Disposable> onSubscribe = mock(Consumer.class);
Action onDispose = mock(Action.class);
doThrow(new TestException("First")).when(onDispose).run();
CompletableSubject cs = CompletableSubject.create();
TestObserver<Void> to = cs.doOnLifecycle(onSubscribe, onDispose).test();
assertTrue(cs.hasObservers());
to.dispose();
assertFalse(cs.hasObservers());
TestHelper.assertUndeliverable(errors, 0, TestException.class, "First");
verify(onSubscribe).accept(any());
verify(onDispose).run();
});
}
use of io.reactivex.rxjava3.subjects.CompletableSubject in project RxJava by ReactiveX.
the class CompletableDoOnLifecycleTest method dispose.
@Test
public void dispose() throws Throwable {
@SuppressWarnings("unchecked") Consumer<? super Disposable> onSubscribe = mock(Consumer.class);
Action onDispose = mock(Action.class);
CompletableSubject cs = CompletableSubject.create();
TestObserver<Void> to = cs.doOnLifecycle(onSubscribe, onDispose).test();
assertTrue(cs.hasObservers());
to.dispose();
assertFalse(cs.hasObservers());
verify(onSubscribe).accept(any());
verify(onDispose).run();
}
use of io.reactivex.rxjava3.subjects.CompletableSubject in project RxJava by ReactiveX.
the class CompletableTakeUntilTest method otherCompletes.
@Test
public void otherCompletes() {
CompletableSubject cs1 = CompletableSubject.create();
CompletableSubject cs2 = CompletableSubject.create();
TestObserver<Void> to = cs1.takeUntil(cs2).test();
to.assertEmpty();
assertTrue(cs1.hasObservers());
assertTrue(cs2.hasObservers());
cs2.onComplete();
assertFalse(cs1.hasObservers());
assertFalse(cs2.hasObservers());
to.assertResult();
}
use of io.reactivex.rxjava3.subjects.CompletableSubject in project RxJava by ReactiveX.
the class CompletableTakeUntilTest method isDisposed.
@Test
public void isDisposed() {
CompletableSubject cs1 = CompletableSubject.create();
CompletableSubject cs2 = CompletableSubject.create();
TestHelper.checkDisposed(cs1.takeUntil(cs2));
}
use of io.reactivex.rxjava3.subjects.CompletableSubject in project RxJava by ReactiveX.
the class CompletableTakeUntilTest method otherErrors.
@Test
public void otherErrors() {
CompletableSubject cs1 = CompletableSubject.create();
CompletableSubject cs2 = CompletableSubject.create();
TestObserver<Void> to = cs1.takeUntil(cs2).test();
to.assertEmpty();
assertTrue(cs1.hasObservers());
assertTrue(cs2.hasObservers());
cs2.onError(new TestException());
assertFalse(cs1.hasObservers());
assertFalse(cs2.hasObservers());
to.assertFailure(TestException.class);
}
Aggregations