Package de.cuioss.test.generator.impl
package de.cuioss.test.generator.impl
Core implementation classes for the CUI test generator framework.
This package provides concrete implementations of various test data generators.
Generator Categories
Collection and Array Generators
CollectionGenerator- Creates Lists, Sets, and other collectionsPrimitiveArrayGenerators- Generates arrays of primitive types
Date and Time Generators
LocalDateGenerator- Generates dates within a reasonable epoch rangeLocalTimeGenerator- Creates times with second precisionLocalDateTimeGenerator- Combines date and time generationZonedDateTimeGenerator- Adds time zone supportZoneOffsetGenerator- Generates time zone offsets
Numeric Generators
NumberGenerator- Generic number generationFloatObjectGenerator- Float values with configurable rangesShortObjectGenerator- Short values across the full range
String and URL Generators
NonBlankStringGenerator- Non-empty string generationURLGenerator- Valid URL generation from predefined sets
Utility Generators
DecoratorGenerator- Wraps and enhances other generators
Common Usage Patterns
// Basic generator usage
var stringGen = new NonBlankStringGenerator();
String value = stringGen.next();
// Collection generation
TypedGenerator<Integer> intGen = Generators.integers(1, 100);
var collectionGen = new CollectionGenerator<>(intGen);
List<Integer> list = collectionGen.list(5);
// Date/Time generation with zones
var dateTimeGen = new ZonedDateTimeGenerator();
ZonedDateTime future = dateTimeGen.future();
// Numeric generation with ranges
var floatGen = new FloatObjectGenerator(0.0f, 100.0f);
Float number = floatGen.next();
// Create a generator for integers
TypedGenerator<Integer> intGen = Generators.integers(1, 100);
// Wrap it in a collection generator
var collectionGen = new CollectionGenerator<>(intGen);
// Generate lists and sets
List<Integer> list = collectionGen.list(5); // List of 5 integers
Set<Integer> set = collectionGen.set(3); // Set of 3 integers
Implementation Notes
- All generators are thread-safe unless explicitly noted otherwise
- Generators follow the fail-fast principle for invalid inputs
- Each generator provides specific configuration options where appropriate
- Documentation includes usage examples from actual tests
- Generators can be combined using the CollectionGenerator or DecoratorGenerator
- Author:
- Oliver Wolff, Eugen Fischer
- See Also:
-
ClassDescriptionEnhances a
TypedGeneratorwith collection generation capabilities.A decorator pattern implementation forTypedGeneratorthat allows wrapping and enhancing existing generators.GeneratesFloatobjects within a configurable range.GeneratesLocalDateinstances within a reasonable range around the epoch.Generates randomLocalDateTimeinstances for testing purposes.GeneratesLocalTimeinstances covering all possible times within a day.Generates non-empty and non-blank string values for testing purposes.GeneratesNumberinstances using integer values.Provides generators for arrays of all Java primitive types.GeneratesShortobjects across the full range of possible short values.Generates validURLinstances from a predefined set of well-known websites.GeneratesZonedDateTimeinstances with random dates, times, and time zones.GeneratesZoneOffsetinstances based on the available system time zones.