Skip to content

Empty Snapshot when implementing own Serializer #165

Closed
@jackmatt2

Description

@jackmatt2

Discussed in #164

Originally posted by ClaudioZesiger April 10, 2024
Hello,
I implemented my own Serializer with Jsonb. The snapshot is written well into the snap-file. But when comparing the snapshot to another snapshot, the body of the existing snapshot from the file is always an empty string.

This is my apply method
@Override public Snapshot apply(Object o, SnapshotSerializerContext context) { String json = this.jsonb.toJson(o); return context.toSnapshot(json); }
The jsonb object is initialized.

I saw that the regex in the implementation does not support line breaks. File Snapshot.java.
String regex = "^(?<name>.*?)(\\[(?<scenario>.*)\\])?=(?<header>\\{.*\\})?(?<snapshot>(.*)$)";
But normally any JSON should be formatted for readability.

Any ideas about this?

Regards
C

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions