java.lang.Object
com.pholser.junit.quickcheck.generator.Generator<Enum>
com.pholser.junit.quickcheck.internal.generator.EnumGenerator
All Implemented Interfaces:
Gen<Enum>, Shrink<Enum>

public class EnumGenerator extends Generator<Enum>
  • Field Details

    • enumType

      private final Class<?> enumType
  • Constructor Details

    • EnumGenerator

      EnumGenerator(Class<?> enumType)
  • Method Details

    • generate

      public Enum<?> 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
    • canShrink

      public boolean canShrink(Object larger)
      Description copied from class: Generator

      Tells whether this generator is allowed to participate in the Shrink process for the given "larger" value.

      Unless overridden, the only criterion for whether a generator is allowed to participate in shrinking a value is if the value can be safely cast to the type of values the generator produces.

      Overrides:
      canShrink in class Generator<Enum>
      Parameters:
      larger - the "larger" value
      Returns:
      whether this generator can participate in "shrinking" the larger value