Fixed toLocalPart; Fixed tests; Fixed formatting#1624
Fixed toLocalPart; Fixed tests; Fixed formatting#1624kingthorin merged 2 commits intodatafaker-net:mainfrom
Conversation
PR Summary
|
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1624 +/- ##
============================================
- Coverage 92.40% 92.26% -0.14%
- Complexity 3356 3357 +1
============================================
Files 331 331
Lines 6613 6636 +23
Branches 654 662 +8
============================================
+ Hits 6111 6123 +12
- Misses 346 349 +3
- Partials 156 164 +8 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull Request Overview
This PR implements improved email address generation from names by adding a new toLocalPart method that converts names to valid email local parts. The implementation handles prefixes, suffixes, and special characters while using only first and last names for email generation.
- Adds a private
toLocalPartmethod that extracts first/last names and removes prefixes/suffixes - Updates
emailAddress(String)andsafeEmailAddress(String)methods to use the new conversion logic - Enhances test coverage with comprehensive test cases for various name formats
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/main/java/net/datafaker/providers/base/Internet.java | Implements toLocalPart method and updates email generation methods with improved documentation |
| src/test/java/net/datafaker/providers/base/InternetTest.java | Adds comprehensive test cases for name-to-email conversion including edge cases |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: Copilot <[email protected]>
|
@rcriosbr Thanks for your contribution, it's much appreciated, and thanks to all for providing feedback and a quick merge! |
Trying to revert the formatting, I messed up my fork. So I thought it best to close the previous PR and start all over again. Here is a new PR. Sorry for the mess.
As suggested, instead of creating a public method, I left the method as private and changed the emailAddress(String name) and safeEmailAddress(String name) methods to use it. This way, it is transparent to users.
According to the diff, it seems that this time I didn't mess up the formatting, and I ran all the tests and none of them failed.