Skip to content

Add support for converting the whole JSON document without using JSONPath #33018

@snicoll

Description

@snicoll

The AssertJ support lets us convert the result of an expression to a target object, something like:

assertThat(mvc.get().uri(/family)).bodyJson().extractingPath("$.familyMembers[0]").convertTo(Member.class)

It's not possible to do the same thing when the whole document should be converted. We can workaround at the moment as follows:

assertThat(mvc.get().uri(/family/0)).bodyJson().extractingPath("$").convertTo(Member.class)

This requires JSONPath for not good reason and requires more boilerplate than it should ideally.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions