Unit testing Rxjava observables that have a delay
问题 I want to be able to unit test an Observable that has a delayed emission, but without actually waiting for the delay time. Is there a way to do this? I'm currently using a CountDownHatch to delay the assert, and that works fine, but increases the test run time. Example: val myObservable: PublishSubject<Boolean> = PublishSubject.create<Boolean>() fun myObservable(): Observable<Boolean> = myObservable.delay(3, TimeUnit.SECONDS) @Test fun testMyObservable() { val testObservable = myObservable()