Skip to content

Commit 4708f8a

Browse files
committed
Improve diagnostics of occurrences of values in JSONArrays
1 parent 81753f4 commit 4708f8a

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
@@ -169,8 +169,8 @@ else if (allSimpleValues(expected)) {
169169
result.fail(key + "[]: Expected " + o + ", but not found");
170170
}
171171
else if (actualCount.get(o) != expectedCount.get(o)) {
172-
result.fail(key + "[]: Expected contains " + expectedCount.get(o) + " " + o
173-
+ " actual contains " + actualCount.get(o));
172+
result.fail(key + "[]: Expected " + expectedCount.get(o) + " occurrence(s) of " + o
173+
+ " but got " + actualCount.get(o) + " occurrence(s)");
174174
}
175175
}
176176
for(Object o : actualCount.keySet()) {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public class JSONCompareTest {
1919
@Test
2020
public void reportsWrongSimpleValueCountInUnorderedArray() throws JSONException {
2121
JSONCompareResult result = compareJSON("[5, 5]", "[5, 7]", LENIENT);
22-
assertThat(result, failsWithMessage(equalTo("[]: Expected contains 2 5 actual contains 1 ; []: Contains 7, but not expected")));
22+
assertThat(result, failsWithMessage(equalTo("[]: Expected 2 occurrence(s) of 5 but got 1 occurrence(s) ; []: Contains 7, but not expected")));
2323
}
2424

2525
@Test

0 commit comments

Comments
 (0)