Arguments in properties being reused
tomakita opened this issue · 4 comments
Let me begin by saying thanks for the great library!
I have a Property that has a number of arguments with custom Generators, and I've noticed that, occasionally, some of the arguments seem to be reused from test to test. For example, in this code:
@Property
public void test(@From(MyClassGenerator.class) MyClass myClassInstance) {
// code that mutates myClassInstance and then makes an assertion
}
The test will mutate myClassInstance
, and then in subsequent call to test
, the same instance of myClassInstance
will be used again. This causes surprising results!
Is this expected behavior? If so, is there a way to tell junit-quickcheck not to do this?
@tomakita Thanks for your interest!
I think the arguments would get reused only in exhaustive mode. Can you boil your issue down to a small example that we can look at?
@tomakita Any news on a minimal reproductive test case for this issue? It would make diagnosis much easier. Thanks!
Hi @pholser, apologies, I haven't found time to work on this yet. Please feel free to close this issue until I'm able to come back with a repro. I definitely don't think you should spend time on this until I can show a quick way of reproducing it. This is on my list of things to do, and I'll let you know when I have a repro, or if I try to come up with one, and fail to do so.
Thanks again!