Interface StructuralAssertions


  • @API(status=STABLE)
    public interface StructuralAssertions
    Allows to customize how structured data is compared in order to check whether a snapshot matches an actual test result.
    Author:
    Simon Taddiken
    See Also:
    SnapshotSerializer, StructuredData
    • Method Detail

      • assertEquals

        void assertEquals​(String storedSnapshot,
                          String serializedActual)
                   throws AssertionError,
                          SnapshotException
        Structurally compares two serialized objects. If comparison fails, this method should throw an AssertionError with a helpful error message.
        Parameters:
        storedSnapshot - The persisted snapshot.
        serializedActual - The serialized actual test result.
        Throws:
        AssertionError - If both objects are not "identical" according to this implementation.
        SnapshotException - If any kind of technical error occurs during comparison.
        API Note:
        Implementors are advised to throw AssertionFailedError instead of plain AssertionError. This allows the user to see an IDE generated diff of the actual and expected values in most IDEs.