private static String calculateSafeUniqueName(String extension, IterationInfo iterationInfo, String snapshotId) {
      Checks.checkArgument(snapshotId.length() <= 100,
        () -> String.format("'snapshotId' is too long, only 100 characters are allowed, but was %d: %s", snapshotId.length(), snapshotId));

      FeatureInfo feature = iterationInfo.getFeature();
      String safeName = sanitize(feature.getName());
      String featureId = feature.getFeatureMethod().getReflection().getName().substring("$spock_feature_".length());
      String iterationIndex = feature.isParameterized() ? String.format(Locale.ROOT, "-[%d]", iterationInfo.getIterationIndex()) : "";
      String snapshotIdSuffix = snapshotId.isEmpty() ? "" : "-" + sanitize(snapshotId);

      int uniqueSuffixLength = 1 + featureId.length() + 1 + extension.length() + iterationIndex.length() + snapshotIdSuffix.length();
      if (safeName.length() + uniqueSuffixLength > 250) {
        safeName = safeName.substring(0, 250 - uniqueSuffixLength);
        return String.format(Locale.ROOT, "%s%s-%s%s.%s", safeName, snapshotIdSuffix, featureId, iterationIndex, extension);
      }
      return String.format(Locale.ROOT, "%s%s%s.%s", safeName, snapshotIdSuffix, iterationIndex, extension);
    }
Allows to specify a custom matcher for the snapshot.
<p>
This is useful when comparing json or similar, which have less strict equality rules.

@param snapshotId      the id of the snapshot to use. In case of multiple snapshots per test, this allows to distinguish them.
@param snapshotMatcher a custom matcher for the snapshot, which is called with the snapshot value and the actual value.
                       The matcher must throw an {@link AssertionError} if the values don't match.
spock-core/src/main/java/spock/lang/Snapshotter.java