From a767718a9694eba3b1b9e07cbb9e414e32daf4e3 Mon Sep 17 00:00:00 2001 From: LightingTom <59653302+LightingTom@users.noreply.github.com> Date: Mon, 12 Apr 2021 20:46:33 +0800 Subject: [PATCH] Fix plural problem in some descriptions --- .../skyscreamer/jsonassert/comparator/DefaultComparator.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/skyscreamer/jsonassert/comparator/DefaultComparator.java b/src/main/java/org/skyscreamer/jsonassert/comparator/DefaultComparator.java index bc71eae4..c958ba17 100644 --- a/src/main/java/org/skyscreamer/jsonassert/comparator/DefaultComparator.java +++ b/src/main/java/org/skyscreamer/jsonassert/comparator/DefaultComparator.java @@ -77,7 +77,9 @@ public void compareValues(String prefix, Object expectedValue, Object actualValu public void compareJSONArray(String prefix, JSONArray expected, JSONArray actual, JSONCompareResult result) throws JSONException { if (expected.length() != actual.length()) { - result.fail(prefix + "[]: Expected " + expected.length() + " values but got " + actual.length()); + String description = " values but got "; + if (expected.length() == 1) description = " value but got "; + result.fail(prefix + "[]: Expected " + expected.length() + description + actual.length()); return; } else if (expected.length() == 0) { return; // Nothing to compare