use of io.reactivex.rxjava3.schedulers.TestScheduler in project RxJava by ReactiveX.
the class FlowableDebounceTest method debounceWithTimeBackpressure.
@Test
public void debounceWithTimeBackpressure() throws InterruptedException {
TestScheduler scheduler = new TestScheduler();
TestSubscriberEx<Integer> subscriber = new TestSubscriberEx<>();
Flowable.merge(Flowable.just(1), Flowable.just(2).delay(10, TimeUnit.MILLISECONDS, scheduler)).debounce(20, TimeUnit.MILLISECONDS, scheduler).take(1).subscribe(subscriber);
scheduler.advanceTimeBy(30, TimeUnit.MILLISECONDS);
subscriber.assertValue(2);
subscriber.assertTerminated();
subscriber.assertNoErrors();
}
use of io.reactivex.rxjava3.schedulers.TestScheduler in project RxJava by ReactiveX.
the class FlowableDebounceTest method before.
@Before
public void before() {
scheduler = new TestScheduler();
Subscriber = TestHelper.mockSubscriber();
innerScheduler = scheduler.createWorker();
}
use of io.reactivex.rxjava3.schedulers.TestScheduler in project RxJava by ReactiveX.
the class ObservableWindowWithStartEndObservableTest method before.
@Before
public void before() {
scheduler = new TestScheduler();
innerScheduler = scheduler.createWorker();
}
use of io.reactivex.rxjava3.schedulers.TestScheduler in project RxJava by ReactiveX.
the class ObservableThrottleFirstTest method before.
@Before
public void before() {
scheduler = new TestScheduler();
innerScheduler = scheduler.createWorker();
observer = TestHelper.mockObserver();
}
use of io.reactivex.rxjava3.schedulers.TestScheduler in project RxJava by ReactiveX.
the class ObservableTimeoutTests method shouldSwitchToOtherAndCanBeUnsubscribedIfOnNextNotWithinTimeout.
@Test
public void shouldSwitchToOtherAndCanBeUnsubscribedIfOnNextNotWithinTimeout() {
PublishSubject<String> other = PublishSubject.create();
Observable<String> source = underlyingSubject.timeout(TIMEOUT, TIME_UNIT, testScheduler, other);
Observer<String> observer = TestHelper.mockObserver();
TestObserver<String> to = new TestObserver<>(observer);
source.subscribe(to);
testScheduler.advanceTimeBy(2, TimeUnit.SECONDS);
underlyingSubject.onNext("One");
testScheduler.advanceTimeBy(4, TimeUnit.SECONDS);
underlyingSubject.onNext("Two");
other.onNext("a");
other.onNext("b");
to.dispose();
// The following messages should not be delivered.
other.onNext("c");
other.onNext("d");
other.onComplete();
InOrder inOrder = inOrder(observer);
inOrder.verify(observer, times(1)).onNext("One");
inOrder.verify(observer, times(1)).onNext("a");
inOrder.verify(observer, times(1)).onNext("b");
inOrder.verifyNoMoreInteractions();
}
Aggregations