Interface ArgumentsGenerator

All Known Implementing Classes:
JetCheckArgumentsGenerator, QuickcheckArgumentsGenerator

public interface ArgumentsGenerator
Turns one input into the arguments for a single trial.

This is the extension point that decouples the fuzzing engine from any particular generation library. The engine owns the byte stream (steered by the Guidance) and hands it over raw; an implementation decides how to map those bytes onto structured arguments for the test method, including how to wrap the stream (for example in a StreamBackedRandom). The reference implementation wraps junit-quickcheck generators, but any framework (Instancio, jetCheck, a custom binding) can implement this contract without the engine knowing about it.

An instance is bound to a single test method and is reused across trials; generate(java.io.InputStream) is called once per trial.

See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    Generates one trial's arguments from the given input.
  • Method Details

    • generate

      Object[] generate(InputStream input)
      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.

      Parameters:
      input - the guided input bytes for this trial
      Returns:
      the arguments to pass to the test method
      Throws:
      SkipTrialException - if this input cannot produce valid arguments and the trial should be skipped