Class ClockGenerator

java.lang.Object
com.pholser.junit.quickcheck.generator.Generator<Clock>
com.pholser.junit.quickcheck.generator.java.time.ClockGenerator
All Implemented Interfaces:
Gen<Clock>, Shrink<Clock>

public class ClockGenerator extends Generator<Clock>
Produces values of type Clock.
  • Field Details

    • UTC_ZONE_ID

      private static final ZoneId UTC_ZONE_ID
    • min

      private Instant min
    • max

      private Instant max
  • Constructor Details

    • ClockGenerator

      public ClockGenerator()
  • Method Details

    • configure

      public void configure(InRange range)

      Tells this generator to produce values within a specified minimum and/or maximum, inclusive, with uniform distribution, down to the nanosecond.

      Instances of this class are configured using Instant strings.

      If an endpoint of the range is not specified, the generator will use instants with values of either Instant.MIN or Instant.MAX as appropriate.

      InRange.format() is ignored. Instants are always parsed using DateTimeFormatter.ISO_INSTANT.

      Parameters:
      range - annotation that gives the range's constraints
    • generate

      public Clock generate(SourceOfRandomness random, GenerationStatus status)
      Description copied from interface: Gen
      Generates a value, possibly influenced by a source of randomness and metadata about the generation.
      Parameters:
      random - source of randomness to be used when generating the value
      status - an object that can be used to influence the generated value. For example, generating lists can use the size method to generate lists with a given number of elements.
      Returns:
      the generated value