Class LocalDateTimeGenerator

java.lang.Object
de.cuioss.test.generator.impl.LocalDateTimeGenerator
All Implemented Interfaces:
TypedGenerator<LocalDateTime>

Generates random LocalDateTime instances for testing purposes. The generator combines LocalDate and LocalTime values to create complete date-time instances.

Generation details:

Example usage:

 var generator = new LocalDateTimeGenerator();
 LocalDateTime dateTime = generator.next();
 // dateTime will be a random but valid LocalDateTime instance
 
Author:
Eugen Fischer
See Also:
  • Constructor Details

  • Method Details

    • next

      public LocalDateTime next()
      Description copied from interface: TypedGenerator
      Generates the next instance based on the generator's configuration. Implementations must ensure thread-safety.
      Specified by:
      next in interface TypedGenerator<LocalDateTime>
      Returns:
      A newly created instance. May be null if the generator explicitly supports null value generation.
    • getType

      Description copied from interface: TypedGenerator
      Provides type information about what kind of objects this generator creates. The default implementation uses the first non-null result from TypedGenerator.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:
      getType in interface TypedGenerator<LocalDateTime>
      Returns:
      The class information indicating which type this generator is responsible for.