Class PropertyResolvingSnapshotConfig

java.lang.Object
au.com.origin.snapshots.config.PropertyResolvingSnapshotConfig
All Implemented Interfaces:
SnapshotConfig

public class PropertyResolvingSnapshotConfig extends Object implements SnapshotConfig
  • Constructor Details

    • PropertyResolvingSnapshotConfig

      public PropertyResolvingSnapshotConfig()
  • Method Details

    • getOutputDir

      public String getOutputDir()
      Description copied from interface: SnapshotConfig
      The 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:
      getOutputDir in interface SnapshotConfig
      Returns:
      snapshot output folder
    • getSnapshotDir

      public String getSnapshotDir()
      Description copied from interface: SnapshotConfig
      Subdirectory to store snapshots in
      Specified by:
      getSnapshotDir in interface SnapshotConfig
      Returns:
      name of subdirectory
    • updateSnapshot

      public Optional<String> updateSnapshot()
      Description copied from interface: SnapshotConfig
      Optional
      Specified by:
      updateSnapshot in interface SnapshotConfig
      Returns:
      snapshots should be updated automatically without verification
    • getSerializer

      public SnapshotSerializer getSerializer()
      Description copied from interface: SnapshotConfig
      Optional Override to supply your own custom serialization function
      Specified by:
      getSerializer in interface SnapshotConfig
      Returns:
      custom serialization function
    • getComparator

      public SnapshotComparator getComparator()
      Description copied from interface: SnapshotConfig
      Optional Override to supply your own custom comparator function
      Specified by:
      getComparator in interface SnapshotConfig
      Returns:
      custom comparator function
    • getReporters

      public List<SnapshotReporter> getReporters()
      Description copied from interface: SnapshotConfig
      Optional 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:
      getReporters in interface SnapshotConfig
      Returns:
      custom reporter functions
    • isCI

      public boolean isCI()
      Description copied from interface: SnapshotConfig
      Optional 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:
      isCI in interface SnapshotConfig
      Returns:
      boolean indicating if we're running on a CI environment or not