in jackson/src/main/java/com/spotify/hamcrest/jackson/IsJsonObject.java [128:147]
protected boolean matchesNode(ObjectNode node, Description mismatchDescription) {
LinkedHashMap<String, Consumer<Description>> mismatchedKeys = new LinkedHashMap<>();
for (Map.Entry<String, Matcher<? super JsonNode>> entryMatcher : entryMatchers.entrySet()) {
final String key = entryMatcher.getKey();
final Matcher<? super JsonNode> valueMatcher = entryMatcher.getValue();
final JsonNode value = node.path(key);
if (!valueMatcher.matches(value)) {
mismatchedKeys.put(key, d -> valueMatcher.describeMismatch(value, d));
}
}
if (!mismatchedKeys.isEmpty()) {
DescriptionUtils.describeNestedMismatches(
entryMatchers.keySet(), mismatchDescription, mismatchedKeys, IsJsonObject::describeKey);
return false;
}
return true;
}