Class QuickcheckArgumentsGenerator

java.lang.Object
edu.berkeley.cs.jqf.fuzz.junit.quickcheck.QuickcheckArgumentsGenerator
All Implemented Interfaces:
ArgumentsGenerator

public final class QuickcheckArgumentsGenerator extends Object implements ArgumentsGenerator
An ArgumentsGenerator backed by junit-quickcheck generators.

Each parameter has its own pre-resolved Generator. On every trial, the guided byte stream is wrapped in a StreamBackedRandom and adapted to a junit-quickcheck SourceOfRandomness so the generators consume it. Running out of input surfaces as an IllegalStateException wrapping an EOFException, which the engine treats as a skipped trial.

The StreamBackedRandom is built with an eight-byte leading-ignore window because SourceOfRandomness's constructor reads eight bytes to seed itself and then discards them; ignoring them keeps generation reading from the first real input byte. This is a junit-quickcheck quirk, so it lives here rather than in the engine.

  • Method Details

    • generate

      public Object[] generate(InputStream input)
      Description copied from interface: ArgumentsGenerator
      Generates one trial's arguments from the given input.

      The array length equals the test method's parameter count. Reading past the end of the input typically surfaces as a SkipTrialException, which the engine treats as a signal to move on to the next input rather than as a test failure.

      Specified by:
      generate in interface ArgumentsGenerator
      Parameters:
      input - the guided input bytes for this trial
      Returns:
      the arguments to pass to the test method