Package org.springframework.test.json
Interface JsonComparator
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Strategy interface used to compare JSON strings.
- Since:
- 6.2
- Author:
- Phillip Webb
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiondefault void
assertIsMatch
(String expectedJson, String actualJson) Assert that theexpectedJson
matches the comparison rules of ths instance against theactualJson
.Compare the given JSON strings.
-
Method Details
-
compare
Compare the given JSON strings.- Parameters:
expectedJson
- the expected JSONactualJson
- the actual JSON- Returns:
- the JSON comparison
-
assertIsMatch
Assert that theexpectedJson
matches the comparison rules of ths instance against theactualJson
. Throw anAssertionError
if the comparison does not match.- Parameters:
expectedJson
- the expected JSONactualJson
- the actual JSON
-