Skip to content
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

EnumSetRandomizer can produce "Collection is empty" exception #489

Open
ghost opened this issue Jan 4, 2023 · 1 comment
Open

EnumSetRandomizer can produce "Collection is empty" exception #489

ghost opened this issue Jan 4, 2023 · 1 comment
Labels
Milestone

Comments

@ghost
Copy link

ghost commented Jan 4, 2023

The default implementation for EnumSetRandomizer takes a abs(new ByteRandomizer().getRandomValue()) as number of elements to randomly copy into the set. This randomizer can produce a 0 which in turn will cause a IllegalArgumentException > "Collection is empty" when fetching a new randomValue for the EnumSet.

Solution:
The minimum value for nbElements should be 1 so either there should be a different default randomizer or when the value is 0 it should become 1

@fmbenhassine
Copy link
Member

That's a valid issue. Thank you for reporting it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant