origin-energy / java-snapshot-testing

Facebook style snapshot testing for JAVA Tests
MIT License
109 stars 15 forks source link

Restore JSON formatting with Jackson 2.16 #163

Closed TobiX closed 10 months ago

TobiX commented 11 months ago

This is a fix for #162 and works by utilizing the formatting features introduced in Jackson 2.16 instead of overwriting Jackson internals. Obviously, this makes it incompatible with Jackson versions older then 2.16.0...

TobiX commented 10 months ago

I found a different solution which is compatible with older and newer Jackson versions and I didn't have to resort to reflection or other strange hacks.

I moved the PrettyPrinter into its own file since I find working with anonymous classes a bit awkward... Just introducing a new constructor looks a bit cleaner IMHO.

jackmatt2 commented 10 months ago

Great - thanks @TobiX, maven artefact should be available in a few hours