Package de.skuzzle.test.snapshots.impl
Interface SnapshotConfiguration
-
@API(status=INTERNAL, since="1.1.0") public interface SnapshotConfigurationSupplies 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 booleanaddOffsetToReportedLinenumbers(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.booleanalwaysPersistActualResult(java.lang.reflect.Method testMethod)Determines whether to persist most recent actual test result in a separate file next to the snapshot.booleanalwaysPersistRawResult(java.lang.reflect.Method testMethod)Determines whether to persist raw snapshot result in a separate file.static SnapshotConfigurationdefaultConfigurationFor(java.lang.Class<?> testClass)Creates a SnapshotConfiguration for the given test class.java.nio.file.PathdetermineSnapshotDirectory()Determines the directory into which the snapshot files for the currently executed test class are persisted.SnapshotTestOptions.DiffFormatdiffFormat(java.lang.reflect.Method testMethod)Defines how diffs are rendered when structural comparison failed.booleanisDeleteOrphanedSnapshots()Whether to delete orphaned snapshot files during test execution.booleanisForceUpdateSnapshots(java.lang.reflect.Method testMethod)Determines whether snapshots are to be forcefully updated during the execution of the given test method.booleanisSoftAssertions()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.0static SnapshotConfigurationlegacyConfigurationFor(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.SnapshotTestOptions.NormalizeLineEndingsnormalizeLineEndings(java.lang.reflect.Method testMethod)How to normalize line endings after default snapshot serialization.java.lang.Class<?>testClass()The class containing the currently executed test.inttextDiffContextLines(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.
-
normalizeLineEndings
@API(since="1.10.0", status=INTERNAL) SnapshotTestOptions.NormalizeLineEndings normalizeLineEndings(java.lang.reflect.Method testMethod)How to normalize line endings after default snapshot serialization.- Parameters:
testMethod- The test method.- Returns:
- Whether to normalize line endings.
- Since:
- 1.10.0
-
diffFormat
@API(status=INTERNAL, since="1.10.0") SnapshotTestOptions.DiffFormat diffFormat(java.lang.reflect.Method testMethod)Defines how diffs are rendered when structural comparison failed.- Parameters:
testMethod- The test method.- Returns:
- The diff format to use.
-
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.0Whether 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.
-
-