Package de.cuioss.test.generator.junit
Annotation Interface GeneratorSeed
Annotation for configuring fixed generator seeds in test cases.
This annotation works in conjunction with
EnableGeneratorController
to provide reproducible test data generation.
Features
- Can be applied at method or class level
- Takes precedence over system property configuration
- Ensures consistent test data across test runs
- Useful for debugging and reproducing test failures
Usage Examples
// Method-level configuration
@EnableGeneratorController
class MyTest {
@Test
@GeneratorSeed(4711L)
void shouldGenerateConsistentData() {
var result = Generators.strings().next();
// Will always generate the same string
}
}
// Class-level configuration
@EnableGeneratorController
@GeneratorSeed(8042L)
class MyReproducibleTest {
@Test
void allTestsUseTheSameSeed() {
// All tests in this class use seed 8042L
}
}
Configuration Priority
- Method-level
@GeneratorSeed - Class-level
@GeneratorSeed - System property configuration
- Author:
- Oliver Wolff
- See Also:
-
Required Element Summary
Required Elements
-
Element Details
-
value
long value- Returns:
- the seed for the generators
-