AdjustableInstantProvider

class AdjustableInstantProvider(instant: Instant = Instant.now().with(ChronoField.NANO_OF_SECOND, 0), adjustmentMillis: Long = 0) : InstantProvider(source)

Implementation of InstantProvider that is adjustable in milliseconds by the use of adjust to simulate changes in time

Constructors

Link copied to clipboard
fun AdjustableInstantProvider(instant: Instant = Instant.now().with(ChronoField.NANO_OF_SECOND, 0), adjustmentMillis: Long = 0)

Functions

Link copied to clipboard
fun adjust(f: (Instant) -> Instant)

Adjusts the time by given function, now will start returning the adjusted instant after calling this

Link copied to clipboard
open override fun now(): Instant

Current instant

Link copied to clipboard
fun reset()

Resets the adjustments made to this instant provider