Skip to content

Commit cdb7de5

Browse files
committed
Tweak non-extensible diagnostic, avoid confusion with strict array ordering
1 parent 114e7c5 commit cdb7de5

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/main/java/org/skyscreamer/jsonassert/JSONCompare.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,12 @@ private static void compareJSON(String prefix, JSONObject expected, JSONObject a
9191
}
9292
}
9393

94-
// If strict, check for vice-versa
94+
// If non-extensible, check for vice-versa
9595
if (!mode.isExtensible()) {
9696
Set<String> actualKeys = getKeys(actual);
9797
for(String key : actualKeys) {
9898
if (!expected.has(key)) {
99-
result.fail("Strict checking failed. Got but did not expect: " + prefix + key);
99+
result.fail("Got unexpected field: " + prefix + key);
100100
}
101101
}
102102
}

src/test/java/org/skyscreamer/jsonassert/JSONCompareTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public void reportsUnexpectedNonNull() throws JSONException {
6767
@Test
6868
public void reportsUnexpectedFieldInNonExtensibleMode() throws JSONException {
6969
JSONCompareResult result = compareJSON("{\"obj\": {}}", "{\"obj\": {\"id\": 3}}", NON_EXTENSIBLE);
70-
assertThat(result, failsWithMessage(equalTo("Strict checking failed. Got but did not expect: obj.id")));
70+
assertThat(result, failsWithMessage(equalTo("Got unexpected field: obj.id")));
7171
}
7272

7373
@Test

0 commit comments

Comments
 (0)