-
Notifications
You must be signed in to change notification settings - Fork 624
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
enhance Json assertions reuseability #3438
Conversation
I would like to keep the name |
* rename beEqualJsonTree to equalJsonTree and make it private * can old JsonTree related equalJson functions be removed?
i have renamed |
@Kantis you happy with this to be merged? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Sorry for taking so long @abendt
This is a suggested change to improve the reusability of the json matchers provided by kotest
Context
In a project we were using http4k and its associated kotest assertions. There is assertion shouldHaveBody that accepts a Matcher<String?> as parameter. Ideally we would have liked to used a matcher from kotests json module here:
What we found is that the matchers from kotest are currently not very suitable for external re-use (JsonTree factory method is internal, parse method is internal, too much logic inside the
shouldX
functions).Changes
We are proposing some changes here to allow easier re-use of the json matchers by external code:
beX
matcher for easier re-useequalJson
tobeEqualJsonTree
for consistencybeEqualJson
that works on stringsbeJsonObject
,beJsonArray
,beJsonObject
) from the correspondingshouldX
assertions to make them re-usableOpen questions
JsonTree
outside of this module (toJsonTree
is internal). shouldbeEqualJsonTree
be made internal too?