Closed marcussatelis closed 6 days ago
It would be useful to see your unit test code, but I'm guessing that you're asserting the json of a Java object. The default object mapper in ModelAssert has not been given the plugin to serialise Java Time objects.
You can make your own ObjectMapper to convert your Java object to JsonNode, and then use that JsonNode in the assertion instead of a raw Java Object.
I think this is a duplicate of #41
It would be useful to see your unit test code, but I'm guessing that you're asserting the json of a Java object. The default object mapper in ModelAssert has not been given the plugin to serialise Java Time objects.
You can make your own ObjectMapper to convert your Java object to JsonNode, and then use that JsonNode in the assertion instead of a raw Java Object.
It really is not convenient. It would be nice to be able to configure the ObjectMapper in one place, instead of having to manually convert to JsonNode for each and every assertion.
@lmartelli I fully understand. Do you want to propose a PR?
Can be resolved by #41, I think. @lmartelli - I've got a new PR #50 - have a look at the README and feed back. I might merge this in the next few days.
There is now a mechanism to provide a custom ObjectMapper
. Use version 1.0.3 for that.
Summary
Error: Java 8 date/time type
java.time.LocalDate
not supported by default: add Module "com.fasterxml.jackson.datatype:jackson-datatype-jsr310" to enable handling (through reference chain: ..."])Json Examples
Simplest Input JSON
Provide the simplest JSON that can illustrate the problem/goal
Simplest comparison
Provide other relevant JSON, or JSON Pointer paths
Expected green or red test
Show the simplest test code that you think should pass or fail for this to work.
Any other information?
Do you know how to fix this? PRs welcome.