Annotation Type SnapshotDirectory


  • @Retention(RUNTIME)
    @Target(TYPE)
    @API(status=EXPERIMENTAL,
         since="1.7.0")
    public @interface SnapshotDirectory
    Drop in replacement for EnableSnapshotTests.snapshotDirectory(). Allows to customize the snapshot directory globally for a test class.

    If you don't customize the snapshot directory at all, then snapshots will by default be stored in a directory structure according to the package name of the test class. If you already specified a custom directory using the DSL (via SnapshotDsl.ChooseDirectory.in(java.nio.file.Path)) then this annotation will have no effect for that particular assertion.

    You can either specify value() which will interpret the string as directory relative to this project's src/test/resources directory. Or you can specify the type of a class that implements SnapshotDirectoryStrategy using determinedBy(). With the strategy you are no longer bounded to use a directory relative to src/test/resources.

    Since:
    1.7.0
    See Also:
    SnapshotDirectoryStrategy, SnapshotDsl.ChooseDirectory
    • Element Detail

      • value

        java.lang.String value
        Define the snapshot directory relative to src/test/resources.

        Note: If you specify a custom SnapshotDirectoryStrategy using determinedBy(), the strategy implementation might apply custom semantics to this value. Check with the respective strategy's documentation.

        Returns:
        The relative directory to store the snapshots.
        Default:
        ""
      • determinedBy

        java.lang.Class<? extends SnapshotDirectoryStrategy> determinedBy
        Specify the type of a class that implements SnapshotDirectoryStrategy. The strategy will be used to determine the actual snapshot directory.

        By default, there is no strategy in place, meaning that the default semantics as described in the documentation to the value() property apply.

        Returns:
        The strategy to use.
        Default:
        de.skuzzle.test.snapshots.DefaultSnapshotDirectoryStrategy.class