generate ID Number together with birthday and gender#1316
Conversation
this commit adds method IdNumber.valid(IdNumberRequest) which returns a valid combination of ID number, birthday and gender.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1316 +/- ##
============================================
+ Coverage 91.82% 91.88% +0.06%
- Complexity 3096 3145 +49
============================================
Files 311 315 +4
Lines 6090 6200 +110
Branches 631 633 +2
============================================
+ Hits 5592 5697 +105
- Misses 342 347 +5
Partials 156 156 ☔ View full report in Codecov by Sentry. |
|
That looks good to me. @kingthorin , any concerns / feedback? |
|
I'll try to review this in the next few hours. |
kingthorin
left a comment
There was a problem hiding this comment.
Only see the one item.
I also predict that we'll have to allow other genders or "prefer not to say" in the future, but I guess that doesn't matter until countries start publishing new specs.
| private String sss(BaseProviders faker, boolean female) { | ||
| int ordinal = female ? faker.number().numberBetween(500, 1000) : faker.number().numberBetween(0, 500); | ||
| private String sss(BaseProviders faker, Gender gender) { | ||
| int ordinal = gender == FEMALE ? faker.number().numberBetween(500, 1000) : faker.number().numberBetween(0, 500); |
There was a problem hiding this comment.
I know it was like this before but is 500 really valid for both?
... to avoid potential risk that we will new values to Gender enum, but forget to handle them in such "if"s.
|
My point was more that it should probably be If it's supposed to be gender specific how can 500 be valid in both cases? |
Here we are talking only about "genders used for ID numbers". As far as I know, all countries either don't use gender at all, or use MALE/FEMALE option.
Yes, this is a valid code because |
|
Okay sorry, thought it was inclusive |
|
@asolntsev want to merge this one? |
|
Sure, yes. :) |
this commit adds method
IdNumber.valid(IdNumberRequest)which returns a valid combination of ID number, birthday and gender.Usage:
Problem to solve:
In many countries, ID Number contains or depends on birthday and/or gender.
We need to generate a valid person containing a valid combination of ID number, birthday and gender matching each other.
Until now, it was possible to generate them separately, but they didn't always match each other: