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 = "^(?.*?)(\\[(?.*)\\])?=(?\\{.*\\})?(?(.*)$)";
`
But normally any JSON should be formatted for readability.
Any ideas about this?
Regards
C
Discussed in https://github.com/origin-energy/java-snapshot-testing/discussions/164