Annotation Interface EnableGeneratorController


JUnit 5 annotation that enables and controls the generator subsystem for test cases. This annotation provides reproducible test data generation by managing generator seeds and providing detailed failure information for test reproduction.

Features

  • Controls generator seed initialization
  • Provides detailed failure information for test reproduction
  • Supports fixed seeds via GeneratorSeed annotation
  • Enables system property configuration for seeds

Usage

 
 @EnableGeneratorController
 class MyGeneratorTest {
     @Test
     void shouldGenerateData() {
         var generator = new CollectionGenerator<>(Generators.strings());
         var result = generator.list(5);
         assertThat(result).hasSize(5);
     }
 }
 
 

Test Reproduction

On test failure, the extension provides detailed information about the generator seed:
 GeneratorController seed was 4711L.
 Use a fixed seed by applying @GeneratorSeed(4711L) for the method/class,
 or by using the system property '-Dde.cuioss.test.generator.seed=4711'
 

Seed Configuration Options

  1. Method-level: @GeneratorSeed(4711L)
  2. Class-level: @GeneratorSeed(4711L)
  3. System Property: -Dde.cuioss.test.generator.seed=4711
Author:
Oliver Wolff
See Also: