Skip to content

swedish ssn cannot have format like XXXXXX-000X#1434

Merged
kingthorin merged 5 commits into
datafaker-net:mainfrom
TrueJacobG:swedish-ssn-fix-gen
Nov 9, 2024
Merged

swedish ssn cannot have format like XXXXXX-000X#1434
kingthorin merged 5 commits into
datafaker-net:mainfrom
TrueJacobG:swedish-ssn-fix-gen

Conversation

@TrueJacobG

@TrueJacobG TrueJacobG commented Nov 6, 2024

Copy link
Copy Markdown
Contributor

swedish ssn cannot have format like XXXXXX-000X, the end number part has to be between 001 and 999

explanation: https://www4.skatteverket.se/rattsligvagledning/edition/2024.5/330242.html#update_20240802105842

Information obtained with help of @jakub-pazio and @Johannestegner

Comment thread src/test/java/net/datafaker/idnumbers/SwedishIdNumberTest.java Outdated

@kingthorin kingthorin left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

Comment thread src/main/java/net/datafaker/idnumbers/SwedenIdNumber.java Outdated
@codecov-commenter

codecov-commenter commented Nov 7, 2024

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.25%. Comparing base (1b19bdc) to head (aabf010).

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #1434      +/-   ##
============================================
+ Coverage     92.18%   92.25%   +0.06%     
- Complexity     3161     3165       +4     
============================================
  Files           320      320              
  Lines          6178     6181       +3     
  Branches        592      593       +1     
============================================
+ Hits           5695     5702       +7     
+ Misses          340      338       -2     
+ Partials        143      141       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Comment thread src/main/java/net/datafaker/idnumbers/SwedenIdNumber.java Outdated
@asolntsev
asolntsev self-requested a review November 9, 2024 01:24

@asolntsev asolntsev left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TrueJacobG There is a way to generate non-"000" number without a loop:

    private String generateEndPart(BaseProviders f) {
        return "%03d".formatted(f.number().numberBetween(1, 1000));
    }

@TrueJacobG
TrueJacobG requested a review from asolntsev November 9, 2024 07:29
@kingthorin
kingthorin merged commit ff110bf into datafaker-net:main Nov 9, 2024
@bodiam

bodiam commented Nov 9, 2024

Copy link
Copy Markdown
Contributor

Thanks @asolntsev , @kingthorin and of course @TrueJacobG for working on this together, nice improvement!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants