Annotation Type Seed


@Documented @Target(METHOD) @Retention(RUNTIME) public @interface Seed
Specifies the seed for the random number generator.

Example:



 @ExtendWith(InstancioExtension.class)
 class ExampleTest {

     @Test
     @Seed(12345)
     void someTestMethod() {
         Person person = Instancio.create(Person.class); // will use the specified seed
     }
 }
 

If the Seed annotation is specified, the same data set will be generated each test run based on the given seed value.

If the seed annotation is not specified, a random seed will be used, resulting in random data generated on each test run.

  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    long
    Specifies seed value for the Random Number Generator.
  • Element Details

    • value

      long value
      Specifies seed value for the Random Number Generator.
      Returns:
      seed value