diff --git a/build.gradle b/build.gradle index 42d733ca..e6f85443 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.Test; 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 class InlineFilterTest extends BaseTest { @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