From 08830e92f462cea4b047f118dcc6ea4511f1e9e4 Mon Sep 17 00:00:00 2001 From: Oswaldo Baptista Vicente Junior <45291656+oswaldobapvicjr@users.noreply.github.com> Date: Sun, 26 Mar 2023 07:31:46 -0300 Subject: [PATCH] Upgrade org.json:json from 20140107 to 20230227 (#907) * Upgrade org.json:json from 20140107 to 20230227 * Remove unused import --- build.gradle | 2 +- .../java/com/jayway/jsonpath/InlineFilterTest.java | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index 334ab46a..74aa0035 100644 --- a/build.gradle +++ b/build.gradle @@ -19,7 +19,7 @@ ext { hamcrest: 'org.hamcrest:hamcrest:2.2', jacksonDatabind: 'com.fasterxml.jackson.core:jackson-databind:2.14.2', jettison: 'org.codehaus.jettison:jettison:1.5.4', - jsonOrg: 'org.json:json:20140107', + jsonOrg: 'org.json:json:20230227', tapestryJson: 'org.apache.tapestry:tapestry-json:5.8.1', jakartaJsonP: 'jakarta.json:jakarta.json-api:2.0.1', jakartaJsonB: 'jakarta.json.bind:jakarta.json.bind-api:2.0.0', diff --git a/json-path/src/test/java/com/jayway/jsonpath/InlineFilterTest.java b/json-path/src/test/java/com/jayway/jsonpath/InlineFilterTest.java index b16fdd16..c428e3e4 100644 --- a/json-path/src/test/java/com/jayway/jsonpath/InlineFilterTest.java +++ b/json-path/src/test/java/com/jayway/jsonpath/InlineFilterTest.java @@ -4,6 +4,7 @@ import org.junit.runner.RunWith; import org.junit.runners.Parameterized; +import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; @@ -73,9 +74,14 @@ public static Iterable configurations() { @Test public void root_context_can_be_referred_in_predicate() { - List prices = using(conf).parse(JSON_DOCUMENT).read("store.book[?(@.display-price <= $.max-price)].display-price", List.class); + List prices = using(conf).parse(JSON_DOCUMENT).read("store.book[?(@.display-price <= $.max-price)].display-price", List.class); - assertThat(prices).containsAll(asList(8.95D, 8.99D)); + assertThat(prices.stream().map(this::asDouble)).containsAll(asList(8.95D, 8.99D)); + } + + private Double asDouble(Object object) { + // For json-org implementation returns a list of big decimals + return object instanceof BigDecimal ? ((BigDecimal) object).doubleValue() : (Double) object; } @Test