Skip to content

Commit

Permalink
Upgrade org.json:json from 20140107 to 20230227 (#907)
Browse files Browse the repository at this point in the history
* Upgrade org.json:json from 20140107 to 20230227

* Remove unused import
  • Loading branch information
oswaldobapvicjr authored Mar 26, 2023
1 parent 4a59845 commit 08830e9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -73,9 +74,14 @@ public static Iterable<Configuration> configurations() {

@Test
public void root_context_can_be_referred_in_predicate() {
List<Double> 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
Expand Down

0 comments on commit 08830e9

Please sign in to comment.