This repository was archived by the owner on Dec 19, 2023. It is now read-only.
feat: improvements for GraphQL response testing facilities #348
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
GraphQLResponse and GraphQLTestTemplate now use the ObjectMapper bean
from the tested application.
The
get
methods now use the object mapper to convert the variable tothe specified type. Formerly they used vanilla JsonPath library methods
that may produce unexpected results. E. g. given the following response
body:
{"data": {"test": 2}}
a call to
get("$.data.test")
would result in anClassCastException
, which is usually not the desired behaviour.It was also very restrictive on data types: only "native" JSON types
were supported (e. g. int, boolean, String).
Furthermore it seems to have issues with more complex classes, like
POJOs and may return
null
.Several test cases were added to ensure correct behaviour. Some of
these tests would fail with the previous version.