Class JsInstantGen

java.lang.Object
jsonvalues.gen.JsInstantGen
All Implemented Interfaces:
fun.gen.Gen<JsInstant>, Function<RandomGenerator,Supplier<JsInstant>>

public final class JsInstantGen extends Object implements fun.gen.Gen<JsInstant>
Represents a JsInstant generator. It can be created using the static factory methods biased() and arbitrary() or, if none of the previous suits your needs, from an instant generator and the function map:

 import fun.gen.Gen;
 import jsonvalues.JsInstant;

 Gen<Instant> instantGen = seed -> () -> {...};
 Gen<JsInstant> jsInstantGen = gen.map(JsInstant::of);
 

Arbitrary generators produce values with a uniform distribution. Biased generators produce potential problematic values with a higher probability, which can help identify and test edge cases.

  • Method Summary

    Modifier and Type
    Method
    Description
     
    static fun.gen.Gen<JsInstant>
    Returns a generator that produces values with a uniform distribution.
    static fun.gen.Gen<JsInstant>
    arbitrary(long min, long max)
    Returns a generator that produces values uniformly distributed over a specified time range.
    static fun.gen.Gen<JsInstant>
    Returns a generator that produces values uniformly distributed over a specified time range.
    static fun.gen.Gen<JsInstant>
    Returns a biased generator that produces potential problematic values with a higher probability.
    static fun.gen.Gen<JsInstant>
    biased(long min, long max)
    Returns a biased instant generator that produces potential problematic values with a higher probability.
    static fun.gen.Gen<JsInstant>
    biased(Instant min, Instant max)
    Returns a biased generator that produces potential problematic values with a higher probability.
    static fun.gen.Gen<JsInstant>
    Returns a biased generator that produces potential problematic values with a higher probability.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface java.util.function.Function

    andThen, compose

    Methods inherited from interface fun.gen.Gen

    classify, classify, collect, collect, distinct, distinct, map, peek, sample, sample, sample, suchThat, suchThat, then
  • Method Details

    • biased

      public static fun.gen.Gen<JsInstant> biased()
      Returns a biased generator that produces potential problematic values with a higher probability. These values include: - The minimum instant value - The maximum instant value
      Returns:
      A biased JsInstant generator.
    • arbitrary

      public static fun.gen.Gen<JsInstant> arbitrary()
      Returns a generator that produces values with a uniform distribution.
      Returns:
      A JsInstant generator.
    • arbitrary

      public static fun.gen.Gen<JsInstant> arbitrary(long min, long max)
      Returns a generator that produces values uniformly distributed over a specified time range.
      Parameters:
      min - The lower bound of the time range (inclusive).
      max - The upper bound of the time range (inclusive).
      Returns:
      A JsInstant generator.
    • arbitrary

      public static fun.gen.Gen<JsInstant> arbitrary(ZonedDateTime min, ZonedDateTime max)
      Returns a generator that produces values uniformly distributed over a specified time range.
      Parameters:
      min - The lower bound of the time range (inclusive).
      max - The upper bound of the time range (inclusive).
      Returns:
      A JsInstant generator.
    • biased

      public static fun.gen.Gen<JsInstant> biased(long min, long max)
      Returns a biased instant generator that produces potential problematic values with a higher probability. These values include: The lower bound of the time range and the upper bound of the time range both in seconds from the epoch time
      Parameters:
      min - The lower bound of the time range in seconds since epoch time (inclusive).
      max - The upper bound of the time range in seconds since epoch time (inclusive).
      Returns:
      A biased JsInstant generator.
    • biased

      public static fun.gen.Gen<JsInstant> biased(Instant min, Instant max)
      Returns a biased generator that produces potential problematic values with a higher probability. These values include: - The lower bound of the time range - The upper bound of the time range
      Parameters:
      min - The lower bound of the time range (inclusive).
      max - The upper bound of the time range (inclusive).
      Returns:
      A biased JsInstant generator.
    • biased

      public static fun.gen.Gen<JsInstant> biased(ZonedDateTime min, ZonedDateTime max)
      Returns a biased generator that produces potential problematic values with a higher probability. These values include: - The lower bound of the time range - The upper bound of the time range
      Parameters:
      min - The lower bound of the time range (inclusive).
      max - The upper bound of the time range (inclusive).
      Returns:
      A biased JsInstant generator.
    • apply

      public Supplier<JsInstant> apply(RandomGenerator seed)
      Specified by:
      apply in interface Function<RandomGenerator,Supplier<JsInstant>>