Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,16 @@ include-code::./FamilyControllerTests[tag=assert-file,indent=0]

If you prefer to use another library, you can provide an implementation of
{spring-framework-api}/test/json/JsonComparator.html[`JsonComparator`].

Alternatively, you can use AssertJ https://github.com/assertj/assertj/blob/3.x/assertj-core/src/main/java/org/assertj/core/api/AssertFactory.java[AssertFactory].
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please rephrase that to be consistent with previous sentences. For instance.

JsonUnit is also supported via the standard convertTomethod. I am not keen to start referring to AssertJ's Javadoc for this.

For example, if you want to use https://github.com/lukas-krecan/JsonUnit[JsonUnit] you can
do this

```
import static net.javacrumbs.jsonunit.assertj.JsonAssertions.jsonUnitJson;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't markdown. We don't compile against JSonUnit so we can't add the example.

...
assertThat(mockMvc.get().uri("/family")).bodyJson()
.convertTo(jsonUnitJson())
.when(IGNORING_ARRAY_ORDER) // This is JsonUnit
.isEqualTo(expectedJson)
```