Configuring generators

If you mark a property parameter with an annotation that is itself marked as @GeneratorConfiguration, then if the Generator for that parameter’s type has a public method named configure that accepts a single argument of the annotation type, junit-quickcheck will call the configure method reflectively, passing it the annotation. The generator can then retain the annotation to influence the results of generate().

Only the available generators that can produce something that is java.io.Serializableand that support all the configuration annotations on a property parameter will be called on to generate a value for that parameter. So, for example, for parameter s above, generators for integral values might be called upon, whereas generators for ArrayLists would not. junit-quickcheck will complain loudly if there are no such generators available.

If you have a family of generators that can produce members of a hierarchy, you may want to ensure that all the generators respect the same attributes of a given configuration annotation. Not doing so could lead to surprising results.

Aggregating configuration

Configuration annotations that are directly on a property parameter, and any configuration annotations on annotations that are directly on a property parameter (and so on…) are collected to configure the generator(s) for the parameter.