Open ashleyfrieze opened 3 years ago
This would be very useful to read files from classpath.. otherwise how would we read such files?
Generally, in tests, you have access to Paths.get("src", "test", "resources")
so it's easy to read test resources.
isEqualTo
supports various types of expected object https://github.com/webcompere/model-assert/blob/main/src/main/java/uk/org/webcompere/modelassert/json/dsl/nodespecific/tree/IsEqualToDsl.java
Your general escape hatch with assertJson
is to first convert things into JsonNode
use Jackson any way you like, and then use assertJson(jsonNode).isEqualTo(expectedJsonNode)
or similar.
However, I can see that InputStream
and maybe even a classpath option would enhance the library.
Note: please upvote this if you would find it useful.
Summary
Should be able to assert using
InputStream
of JSON as either actual or expected