-
Notifications
You must be signed in to change notification settings - Fork 125
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
Allow setting a seed for Random #91
Comments
Yes, of course, you can do it. |
@aSemy There are two failing tests regarding this issue. I disabled them for now. Can you take a look? |
The testcases for this issue is bad because the random generation depends on the BbanStructure and what order the objects added to our EnumMap. |
@MR-Os1 we might have different test cases for both(using random generation or not). |
The point of tests was to verify that the random generation of a single IBAN didn't affect subsequent ones. It's the code that's bad, not the tests 😅. I've opened a PR #126 that should fix the generation, so that each IBAN is generated using an independent Random. Even if multiple IBANs are generated, a seeded IBAN should only change if the structure of its randomly selected country changes, and subsequently generated IBANs shouldn't change. #126 is just one option, maybe there's a way to improve the tests too? |
this is still going to have side effect on adding new BbanStructure |
So maybe it is worth to create a new ticket regarding some improvement to the procedure |
I'm using Kotest property based testing, and this needs a deterministic way of generating random data based on a seed, or existing
Random
instance.iban4j can generate random IBANs, but I can't set a seed or pass in a
Random
instance.I would like to add an overload for the
Iban.random()
method that will accept aRandom
parameter.I can try making a PR for this, if you agree. Thanks!
The text was updated successfully, but these errors were encountered: