Interface SnapshotDsl.ChooseAssertions

  • All Known Subinterfaces:
    SnapshotDsl.ChooseStructure
    Enclosing interface:
    SnapshotDsl

    @API(status=STABLE)
    public static interface SnapshotDsl.ChooseAssertions
    DSL stage to choose how to perform the snapshot assertion.
    Author:
    Simon Taddiken
    • Method Detail

      • disabled

        @API(status=EXPERIMENTAL,
             since="1.5.0")
        @Deprecated
        SnapshotTestResult disabled()
        Deprecated.
        This method is NOT deprecated. Deprecation serves only to mark this method in your IDE as it should only be used temporarily.
        This is a terminal DSL operation which just advances the internal state of the injected Snapshot instance but which does not apply any comparisons. This method is useful if you have multiple assertions within a single test case and you want to temporarily one. If you rely on automatic snapshot naming, subsequent assertions will still work as expected when using this method as opposed to just commenting out the assertion.

        When a DSL statement is terminated with this operation and no persisted snapshot file exists, none will be created. However the actual test result will still be serialized. Thus it is still possible to inspect the serialized result within the return SnapshotTestResult object. However, the referenced snapshot file will not exist in such cases.

        If a snapshot file already exists, it will not be reported as orphan file as long as the assertion is disabled.

        Note: We can not make the same guarantees about orphan detection when using JUnit5's native mechanism for disabling tests. In such cases, we try to make a best effort guess based on statically available information.

        Returns:
        Details about the snapshot. Note that the reference snapshot file might not necessarily exist.
        Since:
        1.5.0
      • matchesSnapshotText

        SnapshotTestResult matchesSnapshotText()
        Asserts that the serialized actual test result matches the persisted snapshot using a generic String diff algorithm. As this assertions only does a String comparison it can be used regardless which SnapshotSerializer has been used.
        Returns:
        Details about the snapshot.
        Throws:
        AssertionError - If the serialized objects do not match.
        See Also:
        TextSnapshot