Description
I have found, that DeterministicScheduler
is the nice way to test code, which uses ScheduledExecutorService
.
As far as I can see it provides similar functionality like TestScheduler provides for code, which uses RxJava or DelayController for Kotlin code, which uses coroutine.
In both cases tick()
does exactly the same as advanceTimeBy()
is doing in earlier mentioning libs: it moves virtual time forward and runs any task, which is expected to be executed within this time frame.
As far as I can see it's general purouse functionality, which could be quite helpful for many people, who is not (or not yet) using jMock mocking functionality.
Thus it would suggest at least to mention it somewhere in the readme or on the main page of the project web site.
I see it mentioned here, but it's hard to find it.
Ideally it would be nice to provide it as a separate JAR/maven artifact so that people can easily pull it without adding whole jmock lib.
As far as I can see the only dependency of DeterministicScheduler
is DeltaQueue
- so it should be easy to extract it.
Perhaps there are some other "utility" classes, which you might find good to extract to such lib as well.
P.S. I have shared the info about this functionality in the corresponding Stack Overflow question.