Annotation 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.

This annotation can also be used as a meta-annotation. A @Seed declared directly on a test method takes precedence over one that is meta-present.

  • 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