Package de.cuioss.test.generator.impl
Class LocalTimeGenerator
java.lang.Object
de.cuioss.test.generator.impl.LocalTimeGenerator
- All Implemented Interfaces:
TypedGenerator<LocalTime>
Generates
LocalTime instances covering all possible times within a day.
The generator creates times with second precision, evenly distributed across
the full 24-hour period.
Features:
- Generates times from 00:00:00 to 23:59:59
- Uses second-level precision
- Even distribution across all possible seconds of the day
- Thread-safe implementation
Example usage:
// Create a generator
var generator = new LocalTimeGenerator();
// Generate single values
LocalTime time = generator.next();
// Generate collections
var collectionGen = new CollectionGenerator<>(generator);
List<LocalTime> times = collectionGen.list(5); // List of 5 times
This generator is particularly useful for testing:
- Time formatting and parsing
- Time-based calculations
- Time range validations
- 24-hour format handling
- Author:
- Eugen Fischer
- See Also:
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
LocalTimeGenerator
public LocalTimeGenerator()
-
-
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<LocalTime>- 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<LocalTime>- Returns:
- The class information indicating which type this generator is responsible for.
-