Implement extracting/contains assertions
See original GitHub issueAssertJ has really powerful extracting/contains mechanism. See: http://joel-costigliola.github.io/assertj/assertj-core-features-highlight.html Section: Assertions on extracted properties/fields of iterable/array elements
I think it worth to implement similar/same for fluent part of the library. I think we can just add assertJ core as a dependency and implement extracting method which returns: “AbstractListAssert” and we’ll just leverage assertions they have. In the end we’ll have something like:
JsonFluentAssert.assertThatJson(jsonResponse.getBody().getObject())
.node("data").isPresent().isArray().ofLength(3)
.extracting(“name”, “age”, “race.name”)
.contains(tuple(“Boromir”, 37, “Man”),
tuple(“Sam”, 38, “Hobbit”),
tuple(“Legolas”, 1000, “Elf”));
What do you think? If you are agree and like the idea, I can work on it.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:22 (11 by maintainers)
Top GitHub Comments
I have started to play with it see https://github.com/lukas-krecan/JsonUnit/pull/102
It works! Although in perfect world this:
could coexist together with this:
but having just one is 100 times better than nothing 😉
Thank you!