Class JetCheckArgumentsGeneratorFactory

java.lang.Object
edu.berkeley.cs.jqf.fuzz.jetcheck.JetCheckArgumentsGeneratorFactory
All Implemented Interfaces:
ArgumentsGeneratorFactory

public final class JetCheckArgumentsGeneratorFactory extends Object implements ArgumentsGeneratorFactory
Builds jetCheck-backed ArgumentsGenerators.

A third reference provider, after junit-quickcheck and Instancio. Unlike Instancio, jetCheck reads its randomness as a stream of ints rather than from a single seed, so Zest's byte-level mutations map onto local, structural changes in the generated value -- a better fit for coverage-guided search.

jetCheck has no reflective object builder, so this provider maps a fixed set of parameter types to jetCheck-built values: the eight primitives (and their wrappers), String, UUID, the java.time date-time types (LocalDate, LocalTime, LocalDateTime, OffsetTime, OffsetDateTime) and their java.sql counterparts (Date, Time, Timestamp). Any other type fails fast with a message pointing to a richer provider.

  • Constructor Details

    • JetCheckArgumentsGeneratorFactory

      public JetCheckArgumentsGeneratorFactory()
  • Method Details

    • create

      public ArgumentsGenerator create(Class<?> testClass, Method testMethod)
      Description copied from interface: ArgumentsGeneratorFactory
      Creates a generator bound to the given test method.
      Specified by:
      create in interface ArgumentsGeneratorFactory
      Parameters:
      testClass - the class declaring the test method
      testMethod - the test method whose arguments will be generated
      Returns:
      a generator for the method's parameters
    • generatorFor

      public static org.jetbrains.jetCheck.Generator<?> generatorFor(Class<?> type)
      Maps a parameter type to a jetCheck generator for one of the supported types.

      Public so a custom factory can reuse these built-in mappings for common types and supply its own generators only for its own types.

      Parameters:
      type - the parameter type
      Returns:
      a generator for that type
      Throws:
      IllegalArgumentException - if the type is not supported