com.hypercubetools.timeslip / TimeSlip
TimeSlip¶
class TimeSlip :Clock
A concrete Clock implementation that is configurable and alterable for the purposes of reproducible tests.
Types¶
| Name | Summary |
|---|---|
| SequenceBuilder | class SequenceBuilderBuilder for a TimeSlip instance backed by a sequence of Instants. |
Functions¶
| Name | Summary |
|---|---|
| done | fun done():UnitInvalidate the clock. |
| getZone | fun getZone():ZoneIdGets the time-zone being used to create dates and times. |
| instant | fun instant():InstantGets the current instant of the clock. |
| moveTo | fun moveTo(newInstant:Instant):UnitChanges the clock to the given instant. |
| tick | fun tick(delta:Duration= ONE_SECOND):UnitMove the clock forward in time. |
| withZone | fun withZone(newZone:ZoneId):ClockReturns a copy of this clock with a different time-zone. |
Companion Object Functions¶
| Name | Summary |
|---|---|
| at | fun at(initialInstant:Instant, zone:ZoneId= DEFAULT_ZONE):TimeSlipCreate an instance that starts at a given time and won't move unless moveTo or tick are called. |
| noCall | fun noCall():TimeSlipCreate an instance that will throw IllegalStateException whenever Clock methods are called. |
| sequence | fun sequence(body:TimeSlip.SequenceBuilder.() ->Unit):TimeSlipCreate a TimeSlip instance backed by a sequence of Instants. |
| sequenceBuilder | fun sequenceBuilder():TimeSlip.SequenceBuilderCreate a builder for a TimeSlip instance backed by a sequence of Instants. |
| startAt | fun startAt(initialInstant:Instant, zone:ZoneId= DEFAULT_ZONE, tickAmount:Duration= ONE_SECOND):TimeSlipCreate an instance that starts at a given time, but moves forward by a constant amount each time the current time is requested. fun startAt(initialInstant:Instant, zone:ZoneId= DEFAULT_ZONE, tickForward:TickForward):TimeSlipCreate an instance that starts at a given time, but changes based on a given function each time the current time is requested. |