Interface SnapshotSerializer


  • @API(status=STABLE)
    public interface SnapshotSerializer
    Defines how an object is serialized into a persistable snapshot String.

    Serializers are closely related to StructuralAssertions. The framework always uses a combination of these two in order to perform a snapshot assertion. When customizing, you should make sure that your implementations are compatible. For example, it would not make sense to serialize objects to json and then use XmlUnit to perform the structural assertions.

    The serialized string will be persisted as 'snapshot' part within a SnapshotFile.

    Author:
    Simon Taddiken
    See Also:
    StructuredData, StructuralAssertions
    • Method Detail

      • serialize

        String serialize​(Object testResult)
                  throws SnapshotException
        Creates a String representation of the provided object.
        Parameters:
        testResult - The object to serialize.
        Returns:
        The serialized object.
        Throws:
        SnapshotException - If the object could not be serialized for technical reasons.