advanceTimeBy

Moves the virtual clock of this dispatcher forward by the specified amount, running the scheduled tasks in the meantime.

Breaking changes from TestCoroutineDispatcher.advanceTimeBy:

  • Intentionally doesn't return a Long value, as its use cases are unclear. We may restore it in the future; please describe your use cases at the issue tracker. For now, it's possible to query currentTime before and after execution of this method, to the same effect.

  • It doesn't run the tasks that are scheduled at exactly currentTime + delayTimeMillis. For example, advancing the time by one millisecond used to run the tasks at the current millisecond and the next millisecond, but now will stop just before executing any task starting at the next millisecond.

  • Overflowing the target time used to lead to nothing being done, but will now run the tasks scheduled at up to (but not including) Long.MAX_VALUE.

Throws

if passed a negative delay.


fun advanceTimeBy(delayTime: Duration)(source)

Moves the virtual clock of this dispatcher forward by the specified amount, running the scheduled tasks in the meantime.

Throws

if passed a negative delay.