mtedone / podam

PODAM - POjo DAta Mocker
https://mtedone.github.io/podam
MIT License
323 stars 750 forks source link

Podam might produce value out of the range, if only @Min or @Max is present on byte,short,int,long field #308

Closed edyda99 closed 2 years ago

edyda99 commented 2 years ago

I have done both debugging and regenerating the bug in tests

Whenever there is only @Min on the field The BeanValidationStrategy.getValue will hook it and do the following

at line 186 the value that comes from getValueInRange(min, max) is Bigger than Integer.Max_Value, when transformed to an integer it sometimes gives a wrong result as specified in java.math documentation "if the resulting "BigInteger" is too big to fit in an int, only the low-order 32 bits are returned."

In case my assumption is valid and there was a bug, I would love to fix it. Thank you

daivanov commented 2 years ago

Will be fixed in podam 7.2.10