Class MutableClock

java.lang.Object
java.time.Clock
spock.util.time.MutableClock

public class MutableClock
extends Clock
A mutable implementation of Clock for testing purposes.
Since:
2.0
  • Constructor Details

    • MutableClock

      public MutableClock()
      Initializes a with Instant.now() and ZoneId.systemDefault() and 1 second changeAmount.
    • MutableClock

      public MutableClock​(Instant instant)
      Initializes a with given instant and ZoneId.systemDefault() and 1 second changeAmount.
      Parameters:
      instant - to use
    • MutableClock

      public MutableClock​(ZoneId zone)
      Initializes a with Instant.now() and given zone and 1 second changeAmount.
      Parameters:
      zone - to use
    • MutableClock

      public MutableClock​(Instant instant, ZoneId zone)
      Initializes a with 1 second changeAmount and given parameters.
      Parameters:
      instant - to use
      zone - to use
    • MutableClock

      public MutableClock​(Instant instant, ZoneId zone, TemporalAmount changeAmount)
    • MutableClock

      public MutableClock​(ZonedDateTime zonedDateTime)
      Initializes a with instant and zone from ZonedDateTime and 1 second changeAmount.
      Parameters:
      zonedDateTime - to use for instant and zone information
  • Method Details