Interface SnapshotConfiguration


  • @API(status=INTERNAL,
         since="1.1.0")
    public interface SnapshotConfiguration
    Supplies configuration options to the snapshot test execution.
    Since:
    1.1.0
    See Also:
    DefaultSnapshotConfiguration
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Deprecated Methods 
      Modifier and Type Method Description
      boolean addOffsetToReportedLinenumbers​(java.lang.reflect.Method testMethod)
      Whether to add an offset to the line numbers in rendered diffs so that the rendered line numbers match the physical lines in the snapshot file.
      boolean alwaysPersistActualResult​(java.lang.reflect.Method testMethod)
      Determines whether to persist most recent actual test result in a separate file next to the snapshot.
      boolean alwaysPersistRawResult​(java.lang.reflect.Method testMethod)
      Determines whether to persist raw snapshot result in a separate file.
      static SnapshotConfiguration defaultConfigurationFor​(java.lang.Class<?> testClass)
      Creates a SnapshotConfiguration for the given test class.
      java.nio.file.Path determineSnapshotDirectory()
      Determines the directory into which the snapshot files for the currently executed test class are persisted.
      boolean isDeleteOrphanedSnapshots()
      Whether to delete orphaned snapshot files during test execution.
      boolean isForceUpdateSnapshots​(java.lang.reflect.Method testMethod)
      Determines whether snapshots are to be forcefully updated during the execution of the given test method.
      boolean isSoftAssertions()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Since 1.7.0 - Soft assertion will no longer be supported with version 2.0
      static SnapshotConfiguration legacyConfigurationFor​(java.lang.Class<?> testClass)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Since 1.7.0 - Only introduced for backward compatibility.
      java.lang.Class<?> testClass()
      The class containing the currently executed test.
      int textDiffContextLines​(java.lang.reflect.Method testMethod)
      Defines how many lines of context are rendered around a changed line-
    • Method Detail

      • defaultConfigurationFor

        @API(status=INTERNAL,
             since="1.7.0")
        static SnapshotConfiguration defaultConfigurationFor​(java.lang.Class<?> testClass)
        Creates a SnapshotConfiguration for the given test class.
        Parameters:
        testClass - The test class.
        Returns:
        The configuration.
        Since:
        1.7.0
      • legacyConfigurationFor

        @Deprecated(since="1.7.0",
                    forRemoval=true)
        @API(status=DEPRECATED,
             since="1.7.0")
        static SnapshotConfiguration legacyConfigurationFor​(java.lang.Class<?> testClass)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Since 1.7.0 - Only introduced for backward compatibility.
      • determineSnapshotDirectory

        java.nio.file.Path determineSnapshotDirectory()
        Determines the directory into which the snapshot files for the currently executed test class are persisted.
        Returns:
        The snapshot directory.
      • testClass

        java.lang.Class<?> testClass()
        The class containing the currently executed test.
        Returns:
        The test class.
      • alwaysPersistActualResult

        @API(status=INTERNAL,
             since="1.7.0")
        boolean alwaysPersistActualResult​(java.lang.reflect.Method testMethod)
        Determines whether to persist most recent actual test result in a separate file next to the snapshot.
        Parameters:
        testMethod - The test method.
        Returns:
        Whether to persist most recent actual result.
        Since:
        1.7.0
      • alwaysPersistRawResult

        @API(status=INTERNAL,
             since="1.7.0")
        boolean alwaysPersistRawResult​(java.lang.reflect.Method testMethod)
        Determines whether to persist raw snapshot result in a separate file.
        Parameters:
        testMethod - The test method.
        Returns:
        Whether to persist raw results.
        Since:
        1.7.0
      • textDiffContextLines

        @API(status=INTERNAL,
             since="1.7.0")
        int textDiffContextLines​(java.lang.reflect.Method testMethod)
        Defines how many lines of context are rendered around a changed line-
        Parameters:
        testMethod - The test method.
        Returns:
        Number of context lines.
        Since:
        1.7.0
      • addOffsetToReportedLinenumbers

        @API(status=INTERNAL,
             since="1.7.1")
        boolean addOffsetToReportedLinenumbers​(java.lang.reflect.Method testMethod)
        Whether to add an offset to the line numbers in rendered diffs so that the rendered line numbers match the physical lines in the snapshot file.
        Parameters:
        testMethod - The test method.
        Returns:
        Whether to add a line number offset.
        Since:
        1.7.1
      • isDeleteOrphanedSnapshots

        boolean isDeleteOrphanedSnapshots()
        Whether to delete orphaned snapshot files during test execution.
        Returns:
        Whether orphaned snapshot files should be removed.
      • isForceUpdateSnapshots

        boolean isForceUpdateSnapshots​(java.lang.reflect.Method testMethod)
        Determines whether snapshots are to be forcefully updated during the execution of the given test method.
        Parameters:
        testMethod - The test method.
        Returns:
        Whether to forcefully update snapshots.
      • isSoftAssertions

        @Deprecated(since="1.7.0",
                    forRemoval=true)
        @API(status=DEPRECATED,
             since="1.7.0")
        boolean isSoftAssertions()
        Deprecated, for removal: This API element is subject to removal in a future version.
        Since 1.7.0 - Soft assertion will no longer be supported with version 2.0
        Whether soft assertions shall be used. When set to true, a failing snapshot assertion will not make the test immediately fail. Instead, all snapshot test results are collected and processed at once when the test method finishes.
        Returns:
        Whether to use soft assertions.