Currently it is hard to integrate Generex and https://github.com/pholser/junit-quickcheck.
Here's "example" implementation: https://github.com/pholser/junit-quickcheck/blob/61e751ceb55cb767d7ef150959df0244543fcd64/examples/src/test/java/com/pholser/junit/quickcheck/examples/text/Structured.java#L51
There are two problems there:
-
Generex(pattern) initialization is performed on each generation. In other words, Generex parses the pattern and builds regex automata for each generate call which is waste.
-
Cloning Random is kind of hard. In practice, Generex#prepareRandom does not need the full power of Random, so it might make sense to add a thin interface RandomSource with methods like nextInt(int) and nextFloat().
Then end-users could instantiate Generex just once, and pick random values as needed (providing it with RandomSource instance).