Interface SnapshotDsl.ChooseDataFormat

  • Enclosing interface:
    SnapshotDsl

    @API(status=STABLE)
    public static interface SnapshotDsl.ChooseDataFormat
    Allows to choose the structure into which the actual test result will be serialized. A custom serializer can be passed using as(SnapshotSerializer).
    • Method Detail

      • asText

        SnapshotDsl.ChooseAssertions asText()
        "Serializes" the actual test result using Object.toString() and compares the results using a generic string diff algorithm.

        Calling this method is equivalent to calling .as(TextSnapshot.text).

        Note: This method will always ignore whitespace changes. This includes any changes in line breaks.

        Returns:
        Fluent API object for performing the snapshot assertion. Do NOT assume it is the same object as 'this'!
        Since:
        0.0.4
        See Also:
        as(StructuredDataProvider)
      • as

        SnapshotDsl.ChooseStructure as​(StructuredDataProvider structuredDataProvider)
        Specify the serialization format and the way in which serialized objects are compared. A StructuredData instance combines both a SnapshotSerializer and a StructuralAssertions instance.

        Note: This method immediately unwraps the given StructuredDataProvider by calling its build method.

        Implementations are generally provided by each of the available extension modules and follow the naming scheme [Format]Snapshot. The following implementations are provided by the respective maven artifacts:

        StructuredDataProvider implementations
        StructuredDataProvider Maven Artifact
        TextSnapshot included in snapshot-tests-core
        de.skuzzle.tests.snapshots.data.JsonSnapshot snapshot-tests-jackson
        de.skuzzle.tests.snapshots.data.XmlSnapshot snapshot-tests-jaxb or snapshot-tests-jaxb-jakarta
        de.skuzzle.tests.snapshots.data.HtmlSnapshot snapshot-tests-html
        Parameters:
        structuredDataProvider - The StructuredDataProvider instance.
        Returns:
        Fluent API object for performing the snapshot assertion. Do NOT assume it is the same object as 'this'!
        See Also:
        StructuredData
      • as

        SnapshotDsl.ChooseAssertions as​(SnapshotSerializer serializer)
        Specify the serialization format.
        Parameters:
        serializer - The serializer to use.
        Returns:
        Fluent API object for performing the snapshot assertion. Do NOT assume it is the same object as 'this'!