use of io.reactivex.rxjava3.schedulers.TestScheduler in project RxJava by ReactiveX.
the class FlowableWindowWithStartEndFlowableTest 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 MaybeDelaySubscriptionTest method timedTestScheduler.
@Test
public void timedTestScheduler() {
TestScheduler scheduler = new TestScheduler();
TestObserver<Integer> to = Maybe.just(1).delaySubscription(100, TimeUnit.MILLISECONDS, scheduler).test();
to.assertEmpty();
scheduler.advanceTimeBy(99, TimeUnit.MILLISECONDS);
to.assertEmpty();
scheduler.advanceTimeBy(1, TimeUnit.MILLISECONDS);
to.assertResult(1);
}
use of io.reactivex.rxjava3.schedulers.TestScheduler in project RxJava by ReactiveX.
the class MaybeDelayTest method delayedErrorOnError.
@Test
public void delayedErrorOnError() {
final TestScheduler scheduler = new TestScheduler();
final TestObserver<?> observer = Maybe.error(new TestException()).delay(5, TimeUnit.SECONDS, scheduler, true).test();
scheduler.advanceTimeTo(2, TimeUnit.SECONDS);
observer.assertNoErrors();
scheduler.advanceTimeTo(5, TimeUnit.SECONDS);
observer.assertError(TestException.class);
}
use of io.reactivex.rxjava3.schedulers.TestScheduler in project RxJava by ReactiveX.
the class MaybeDelayTest method disposeDuringDelay.
@Test
public void disposeDuringDelay() {
TestScheduler scheduler = new TestScheduler();
TestObserver<Integer> to = Maybe.just(1).delay(100, TimeUnit.MILLISECONDS, scheduler).test();
to.dispose();
scheduler.advanceTimeBy(1, TimeUnit.SECONDS);
to.assertEmpty();
}
use of io.reactivex.rxjava3.schedulers.TestScheduler in project RxJava by ReactiveX.
the class SingleDelayTest method delayedErrorOnError.
@Test
public void delayedErrorOnError() {
final TestScheduler scheduler = new TestScheduler();
final TestObserver<?> observer = Single.error(new TestException()).delay(5, TimeUnit.SECONDS, scheduler, true).test();
scheduler.advanceTimeTo(2, TimeUnit.SECONDS);
observer.assertNoErrors();
scheduler.advanceTimeTo(5, TimeUnit.SECONDS);
observer.assertError(TestException.class);
}
Aggregations