Package au.com.origin.snapshots.config
Class PropertyResolvingSnapshotConfig
java.lang.Object
au.com.origin.snapshots.config.PropertyResolvingSnapshotConfig
- All Implemented Interfaces:
SnapshotConfig
-
Field Summary
Fields inherited from interface au.com.origin.snapshots.config.SnapshotConfig
JVM_UPDATE_SNAPSHOTS_PARAMETER -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionOptional Override to supply your own custom comparator functionThe base directory where files get written (excluding package directories) default: "src/test/java"Optional Override to supply your own custom reporter functions Reporters will run in the same sequence as provided.Optional Override to supply your own custom serialization functionSubdirectory to store snapshots inbooleanisCI()Optional This method is meant to detect if we're running on a CI environment.Optional
-
Constructor Details
-
PropertyResolvingSnapshotConfig
public PropertyResolvingSnapshotConfig()
-
-
Method Details
-
getOutputDir
Description copied from interface:SnapshotConfigThe base directory where files get written (excluding package directories) default: "src/test/java"You might want to override if you have tests under "src/test/integration" for example
- Specified by:
getOutputDirin interfaceSnapshotConfig- Returns:
- snapshot output folder
-
getSnapshotDir
Description copied from interface:SnapshotConfigSubdirectory to store snapshots in- Specified by:
getSnapshotDirin interfaceSnapshotConfig- Returns:
- name of subdirectory
-
updateSnapshot
Description copied from interface:SnapshotConfigOptional- Specified by:
updateSnapshotin interfaceSnapshotConfig- Returns:
- snapshots should be updated automatically without verification
-
getSerializer
Description copied from interface:SnapshotConfigOptional Override to supply your own custom serialization function- Specified by:
getSerializerin interfaceSnapshotConfig- Returns:
- custom serialization function
-
getComparator
Description copied from interface:SnapshotConfigOptional Override to supply your own custom comparator function- Specified by:
getComparatorin interfaceSnapshotConfig- Returns:
- custom comparator function
-
getReporters
Description copied from interface:SnapshotConfigOptional Override to supply your own custom reporter functions Reporters will run in the same sequence as provided. Reporters should throw exceptions to indicate comparison failure. Exceptions thrown from reporters are aggregated and reported together. Reporters that wish to leverage IDE comparison tools can use standard assertion libraries like assertj, junit jupiter assertions (or) opentest4j.- Specified by:
getReportersin interfaceSnapshotConfig- Returns:
- custom reporter functions
-
isCI
public boolean isCI()Description copied from interface:SnapshotConfigOptional This method is meant to detect if we're running on a CI environment. This is used to determine the action to be taken when a snapshot is not found.If this method returns false, meaning we're NOT running on a CI environment (probably a dev machine), a new snapshot is created when not found.
If this method returns true, meaning we're running on a CI environment, no new snapshots are created and an error is thrown instead to prevent tests from silently passing when snapshots are not found.
Often to determine if running on a CI environment is to check for the presence of a 'CI' env variable
- Specified by:
isCIin interfaceSnapshotConfig- Returns:
- boolean indicating if we're running on a CI environment or not
-