By default, verifyAsJson
method does not display fields with null
values.
To modify this behavior and display null fields,
follow the example provided below.
Person person = new Person("Max", null, 1);
JsonApprovals.verifyAsJson(person, GsonBuilder::serializeNulls);