Annotation Type SaveSamples


@Retention(RUNTIME)
@Target(METHOD)
public @interface SaveSamples
The @SaveSamples-annotation may be used at any test method as a convenient way to record samples from a running test. The recorded samples are saved as a JSON-file and are usually loaded by @LoadSamples

The file's name is composed of two parts: [rootPath][fileName]. DeepSampler generates a default name using the test class and test method. In most cases this will suffice, however you can change the path in detail:

  • rootPath: The root path for relative packagePaths is by default './'. It can be changed, using the annotation * SampleRootPath.
  • value(): The concrete name of the JSON-file. If omitted, the name of the test class, including it's package, and the test method is used.

This annotation must be used in combination with @UseSamplerFixture.

It is possible to register customisations of the serialization-process using the annotations UseJsonSerializer and @UseBeanConverterExtension.

  • Optional Element Summary

    Optional Elements
    Modifier and Type Optional Element Description
    java.lang.String value
    The name of the json file.
  • Element Details

    • value

      java.lang.String value
      The name of the json file. Default is the package of the test class, followed by the name of the test class, followed by the name of the test method.
      Returns:
      the name of the sample JSON file.
      Default:
      "`v\u00b0\u00b0v\u00b4$de.ppi.deepsampler.junit.AnnotationConstants$$$DefaultValueMustBeCalculated$"