Package de.cuioss.test.generator.domain
Class EmailGenerator
java.lang.Object
de.cuioss.test.generator.domain.EmailGenerator
- All Implemented Interfaces:
TypedGenerator<String>
Generates syntactically valid email addresses for testing purposes.
The generator creates email addresses in the format: firstname.lastname@domain.tld
- First and last names are taken from
NameGenerators.FIRSTNAMES_ANY_ENGLISHandNameGenerators.FAMILY_NAMES_ENGLISH - Domains include: email, mail, cuioss, message, example, hospital
- TLDs include: de, org, com, net
Example usage:
var generator = new EmailGenerator();
String email = generator.next(); // e.g. "john.doe@mail.com"
// Or create email directly from names
String email = EmailGenerator.createEmail("john", "doe"); // e.g. "john.doe@example.org"
- Author:
- Oliver Wolff
-
Constructor Details
-
EmailGenerator
public EmailGenerator()
-
-
Method Details
-
next
Description copied from interface:TypedGeneratorGenerates the next instance based on the generator's configuration. Implementations must ensure thread-safety.- Specified by:
nextin interfaceTypedGenerator<String>- Returns:
- A newly created instance. May be null if the generator explicitly supports null value generation.
-
createEmail
Creates an email address from given first and last names. All components are converted to lowercase.- Parameters:
firstname- The person's first name, must not be null or emptylastname- The person's last name, must not be null or empty- Returns:
- An email address in the format firstname.lastname@domain.tld. Returns "invalid.email@example.com" if either name component is null or empty.
-