Package de.cuioss.test.generator.domain
Class PhoneNumberGenerator
java.lang.Object
de.cuioss.test.generator.domain.PhoneNumberGenerator
- All Implemented Interfaces:
TypedGenerator<String>
Generates random German-style phone numbers for testing purposes.
Phone number format: 0XXX/YYYY where:
- XXX: Area code (100-999)
- YYYY: Local number (1000-9999)
The generated numbers follow a simplified German phone number pattern:
- Always starts with '0' (domestic format)
- 3-digit area code
- Forward slash separator
- 4-digit local number
Example outputs:
"0123/4567" "0789/1234"
Example usage:
var generator = new PhoneNumberGenerator(); String phoneNumber = generator.next(); // Returns a phone number like "0123/4567"
- Author:
- Oliver Wolff
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
PhoneNumberGenerator
public PhoneNumberGenerator()
-
-
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.
-
getType
Description copied from interface:TypedGeneratorProvides type information about what kind of objects this generator creates. The default implementation uses the first non-null result fromTypedGenerator.next()to determine the type.Note: If your generator may return null values or the generated type differs from the actual instance type, you should override this method.
- Specified by:
getTypein interfaceTypedGenerator<String>- Returns:
- The class information indicating which type this generator is responsible for.
-