-
Notifications
You must be signed in to change notification settings - Fork 232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorrect behaviour of overrideDefaultInitialization when there is no default constructor #228
Comments
Not sure if this issue is valid. Non default constructor will never be called (by objenesis). The only trick I see, when there is no default constructor, is to try to call (one of) the existing constructor(s) with random parameters.. But this is too much work IMO and not worth it. Random Beans was designed to randomize Java beans, which by definition, provide a default constructor. |
@PascalSchumacher What do you think? Should we keep the behaviour of |
I agree that adding support for calling non-default constructors would require serious work and I'm not sure how useful it is. Let's keep and document the current behavior for now. |
Great, I will update the documentation about that. |
When there is no default constructor in the randomized type, default initialization in the constructor is overridden (ie fields are randomizerd) even when the
overrideDefaultInitialization
is not set.Here is a failing test with v3.4.0:
What happens behind the scene is that:
overrideDefaultInitialization
parameter)The text was updated successfully, but these errors were encountered: