Package de.cuioss.test.generator.domain
Class UUIDStringGenerator
java.lang.Object
de.cuioss.test.generator.domain.UUIDStringGenerator
- All Implemented Interfaces:
TypedGenerator<String>
Generates random UUID strings in the standard 8-4-4-4-12 format (e.g. "550e8400-e29b-41d4-a716-446655440000").
The generator is thread-safe and produces reproducible results when using the same seed.
Example usage from tests:
var generator = new UUIDStringGenerator(); String uuid = generator.next(); // Returns a valid UUID string UUID.fromString(uuid); // Can be parsed back to UUID
- Author:
- Oliver Wolff
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
UUIDStringGenerator
public UUIDStringGenerator()
-
-
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.
-