I have a very simple function that defers a value with a given delay:
Flowable.defer<Effect> { Flowable.just(Effect.Success) as Publisher<out Effect> }
.delay(2, TimeUnit.SECONDS)
.subscribeOn(computationScheduler)
.observeOn(mainScheduler)
I try to test it advancing the time in the computationScheduler like this:
private val mainScheduler = Schedulers.trampoline()
private val computationScheduler = TestScheduler()
@Test
fun solve() {
val testObserver = actor.invoke(Action.Solve).test()
computationScheduler.advanceTimeBy(3, TimeUnit.SECONDS)
testObserver.assertValues(Effect.Success)
}
Without the delay, this just works, but it seems I can't manage to advance the time properly. Thanks in advance for your help