Skip to content

Commit

Permalink
Support for email subjects. (#924)
Browse files Browse the repository at this point in the history
Co-authored-by: Erik Pragt <[email protected]>
  • Loading branch information
kingthorin and bodiam authored Aug 14, 2023
1 parent 4e34a24 commit 7c881a4
Show file tree
Hide file tree
Showing 4 changed files with 100 additions and 83 deletions.
4 changes: 4 additions & 0 deletions src/main/java/net/datafaker/providers/base/Internet.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ private String emailAddress(String localPart, String domain) {
return String.join("", stripAccents(localPart), "@", domain);
}

public String emailSubject() {
return resolve("internet.email_subject");
}

public static final Pattern DIACRITICS_AND_FRIENDS
= Pattern.compile("[\\p{InCombiningDiacriticalMarks}\\p{IsLm}\\p{IsSk}]+");

Expand Down
164 changes: 81 additions & 83 deletions src/main/resources/en/hobby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,131 +3,97 @@ en:
hobby:
activity:
- "3D printing"
- "amateur radio"
- "scrapbook"
- "Amateur radio"
- "Acting"
- "Air sports"
- "Amateur radio"
- "Archery"
- "Astronomy"
- "BASE jumping"
- "Backpacking"
- "Baseball"
- "Basketball"
- "Baton twirling"
- "Beekeeping"
- "Bird watching"
- "Blacksmithing"
- "Board games"
- "Board sports"
- "Bodybuilding"
- "Book restoration"
- "Brazilian jiu-jitsu"
- "Cabaret"
- "Calligraphy"
- "Candle making"
- "Computer programming"
- "Coffee roasting"
- "Cooking"
- "Coloring"
- "Community"
- "Computer programming"
- "Cooking"
- "Cosplaying"
- "Couponing"
- "Creative writing"
- "Crocheting"
- "Cryptography"
- "Cycling"
- "Dance"
- "Digital arts"
- "Do it yourself"
- "Dowsing"
- "Drama"
- "Drawing"
- "Do it yourself"
- "Driving"
- "Electronics"
- "Embroidery"
- "Fashion"
- "Fishing"
- "Flag Football"
- "Flower arranging"
- "Flying disc"
- "Flying"
- "Foraging"
- "Foreign language learning"
- "Gaming"
- "tabletop games"
- "role-playing games"
- "Gambling"
- "Gaming"
- "Gardening"
- "Genealogy"
- "Geocaching"
- "Ghost hunting"
- "Glassblowing"
- "Graffiti"
- "Gunsmithing"
- "Handball"
- "Hiking"
- "Homebrewing"
- "Hooping"
- "Horseback riding"
- "Hunting"
- "Ice skating"
- "Inline skating"
- "Jewelry making"
- "Jigsaw puzzles"
- "Jogging"
- "Juggling"
- "Knapping"
- "Knitting"
- "Kabaddi"
- "Kayaking"
- "Kite flying"
- "Kitesurfing"
- "Knapping"
- "Knife making"
- "Knitting"
- "LARPing"
- "Lacemaking"
- "Lapidary"
- "Leather crafting"
- "Lego building"
- "Letterboxing"
- "Listening to music"
- "Lockpicking"
- "Machining"
- "Macrame"
- "Metalworking"
- "Magic"
- "Model building"
- "Listening to music"
- "Origami"
- "Painting"
- "Playing musical instruments"
- "Pet"
- "Poi"
- "Pottery"
- "Puzzles"
- "Quilting"
- "Reading"
- "Scrapbooking"
- "Sculpting"
- "Sewing"
- "Singing"
- "Sketching"
- "Soapmaking"
- "Sports"
- "Stand-up comedy"
- "Sudoku"
- "Table tennis"
- "Taxidermy"
- "Video gaming"
- "Watching movies"
- "Web surfing"
- "Whittling"
- "Wood carving"
- "Woodworking"
- "Worldbuilding"
- "Writing"
- "Yoga"
- "Yo-yoing"
- "Air sports"
- "Archery"
- "Astronomy"
- "Backpacking"
- "BASE jumping"
- "Baseball"
- "Basketball"
- "Beekeeping"
- "Bird watching"
- "Blacksmithing"
- "Board sports"
- "Bodybuilding"
- "Brazilian jiu-jitsu"
- "Community"
- "Cycling"
- "Dowsing"
- "Driving"
- "Fishing"
- "Flag Football"
- "Flying"
- "Flying disc"
- "Foraging"
- "Gardening"
- "Geocaching"
- "Ghost hunting"
- "Graffiti"
- "Handball"
- "Hiking"
- "Hooping"
- "Horseback riding"
- "Hunting"
- "Inline skating"
- "Jogging"
- "Kayaking"
- "Kite flying"
- "Kitesurfing"
- "LARPing"
- "Letterboxing"
- "Metal detecting"
- "Metalworking"
- "Model building"
- "Motor sports"
- "Mountain biking"
- "Mountaineering"
Expand All @@ -136,36 +102,68 @@ en:
- "Netball"
- "Nordic skating"
- "Orienteering"
- "Origami"
- "Paintball"
- "Painting"
- "Parkour"
- "Pet"
- "Photography"
- "Playing musical instruments"
- "Poi"
- "Polo"
- "Pottery"
- "Puzzles"
- "Quilting"
- "Rafting"
- "Rappelling"
- "Reading"
- "Rock climbing"
- "Role-playing games"
- "Roller skating"
- "Rowing"
- "Rugby"
- "Running"
- "Sailing"
- "Sand art"
- "Scouting"
- "Scrapbooking"
- "Scuba diving"
- "Sculling"
- "Rowing"
- "Sculpting"
- "Sewing"
- "Shooting"
- "Shopping"
- "Singing"
- "Skateboarding"
- "Sketching"
- "Skiing"
- "Skimboarding"
- "Skydiving"
- "Slacklining"
- "Snowboarding"
- "Soapmaking"
- "Sports"
- "Stand-up comedy"
- "Stone skipping"
- "Sudoku"
- "Surfing"
- "Swimming"
- "Table tennis"
- "Tabletop games"
- "Taekwondo"
- "Tai chi"
- "Taxidermy"
- "Urban exploration"
- "Vacation"
- "Vehicle restoration"
- "Video gaming"
- "Watching movies"
- "Water sports"
- "Web surfing"
- "Whittling"
- "Wood carving"
- "Woodworking"
- "Worldbuilding"
- "Writing"
- "Yo-yoing"
- "Yoga"
10 changes: 10 additions & 0 deletions src/main/resources/en/internet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@ en:
- "hotmail.com"
safe_email:
- "example.com"
email_subject:
- "You're Invited!"
- "Are You Interested In #{Hobby.activity}?"
- "Studies show only 10% of people can do #{OlympicSport.summerOlympics}!"
- "Free Resources to Help You Win #{VideoGame.title}!"
- "Visit #{Country.name}"
- "Want to play a game?"
- "Since we can’t all win the lottery..."
- "#{FamousLastWords}"
- "Happy Holidays From #{Company.name}"
domain_suffix:
- "com"
- "biz"
Expand Down
5 changes: 5 additions & 0 deletions src/test/java/net/datafaker/providers/base/InternetTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ void testUsername() {
assertThat(faker.internet().username()).matches("^(\\w+)\\.(\\w+)$");
}

@RepeatedTest(10)
void emailSubject() {
assertThat(faker.internet().emailSubject()).isNotBlank();
}

@Test
void testUsernameWithSpaces() {
final Name name = Mockito.spy(new Name(mockedFaker));
Expand Down

0 comments on commit 7c881a4

Please sign in to comment.