Class ArbitraryDecorator<T>

  • Type Parameters:
    T - The type of object to be generated by this arbitrary
    All Implemented Interfaces:
    java.lang.Cloneable, Arbitrary<T>

    public abstract class ArbitraryDecorator<T>
    extends java.lang.Object
    implements java.lang.Cloneable, Arbitrary<T>
    Use this superclass if you want to provide a specialized type of arbitrary.
    See Also:
    Arbitrary, Arbitraries
    • Constructor Detail

      • ArbitraryDecorator

        public ArbitraryDecorator()
    • Method Detail

      • arbitrary

        protected abstract Arbitrary<T> arbitrary()
        Implement by calling jqwik's standard DSL for building arbitraries.
        a new arbitrary instance
      • generator

        public RandomGenerator<T> generator​(int genSize)
        Description copied from interface: Arbitrary
        Create the random generator for an arbitrary.

        Starting with version 1.4.0 the returned generator should no longer include edge cases explicitly since those will be injected in Arbitrary.generator(int, boolean)

        Specified by:
        generator in interface Arbitrary<T>
        genSize - a very unspecific configuration parameter that can be used to influence the configuration and behaviour of a random generator if and only if the generator wants to be influenced. Many generators are independent of genSize.

        The default value of genSize is the number of tries configured for a property. Use Arbitrary.fixGenSize(int) to fix the parameter for a given arbitrary.

        a new random generator instance
      • generatorWithEmbeddedEdgeCases

        public RandomGenerator<T> generatorWithEmbeddedEdgeCases​(int genSize)
        Description copied from interface: Arbitrary
        Create the random generator for an arbitrary where the embedded generators, if there are any, also generate edge cases.

        Override only if there are any embedded arbitraries / generators, e.g. a container using an element generator

        Specified by:
        generatorWithEmbeddedEdgeCases in interface Arbitrary<T>
        genSize - See Arbitrary.generator(int) about meaning of this parameter
        a new random generator instance
      • exhaustive

        public java.util.Optional<ExhaustiveGenerator<T>> exhaustive​(long maxNumberOfSamples)
        Description copied from interface: Arbitrary
        Create the exhaustive generator for an arbitrary. Depending on maxNumberOfSamples this can take a long time. This method must be overridden in all arbitraries that support exhaustive generation.
        Specified by:
        exhaustive in interface Arbitrary<T>
        maxNumberOfSamples - The maximum number of samples considered. If during generation it becomes clear that this number will be exceeded generation stops.
        a new exhaustive generator or Optional.empty() if it cannot be created.
      • toString

        public java.lang.String toString()
        toString in class java.lang.Object
      • typedClone

        protected <A extends Arbitrary<?>> A typedClone()
        Use to clone current instance with its interface type
        Type Parameters:
        A - The special interface type of this arbitrary
        A cloned instance of this arbitrary