From 0289ac00c44efe330ef088e779eb6199b0800ba7 Mon Sep 17 00:00:00 2001 From: Jochen Berger Date: Mon, 15 Sep 2014 14:12:42 +0200 Subject: [PATCH] replace usage of JsonProviderFactory in other modules --- .../src/main/java/com/jayway/jsonassert/JsonAssert.java | 8 +++++--- .../main/java/com/jayway/jsonpath/web/bench/Bench.java | 3 +-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/json-path-assert/src/main/java/com/jayway/jsonassert/JsonAssert.java b/json-path-assert/src/main/java/com/jayway/jsonassert/JsonAssert.java index f4a44608..2dd09855 100644 --- a/json-path-assert/src/main/java/com/jayway/jsonassert/JsonAssert.java +++ b/json-path-assert/src/main/java/com/jayway/jsonassert/JsonAssert.java @@ -7,7 +7,9 @@ import com.jayway.jsonassert.impl.matcher.IsCollectionWithSize; import com.jayway.jsonassert.impl.matcher.IsEmptyCollection; import com.jayway.jsonassert.impl.matcher.IsMapContainingKey; import com.jayway.jsonassert.impl.matcher.IsMapContainingValue; -import com.jayway.jsonpath.spi.json.JsonProviderFactory; +import com.jayway.jsonpath.JsonPath; +import com.jayway.jsonpath.internal.spi.json.JsonSmartJsonProvider; + import org.hamcrest.Matcher; import java.io.IOException; @@ -30,7 +32,7 @@ public class JsonAssert { * @throws ParseException when the given JSON could not be parsed */ public static JsonAsserter with(String json) { - return new JsonAsserterImpl(JsonProviderFactory.createProvider().parse(json)); + return new JsonAsserterImpl(JsonPath.parse(json).json()); } /** @@ -41,7 +43,7 @@ public class JsonAssert { * @throws ParseException when the given JSON could not be parsed */ public static JsonAsserter with(Reader reader) throws IOException { - return new JsonAsserterImpl(JsonProviderFactory.createProvider().parse(convertReaderToString(reader))); + return new JsonAsserterImpl(JsonPath.parse(convertReaderToString(reader)).json()); } diff --git a/json-path-web-test/src/main/java/com/jayway/jsonpath/web/bench/Bench.java b/json-path-web-test/src/main/java/com/jayway/jsonpath/web/bench/Bench.java index 42a76f63..991b7924 100644 --- a/json-path-web-test/src/main/java/com/jayway/jsonpath/web/bench/Bench.java +++ b/json-path-web-test/src/main/java/com/jayway/jsonpath/web/bench/Bench.java @@ -4,7 +4,6 @@ import com.jayway.jsonpath.Configuration; import com.jayway.jsonpath.JsonPath; import com.jayway.jsonpath.Option; import com.jayway.jsonpath.internal.spi.json.JacksonProvider; -import com.jayway.jsonpath.spi.json.JsonProviderFactory; import io.gatling.jsonpath.JsonPath$; import org.boon.json.JsonParser; import org.boon.json.ObjectMapper; @@ -71,7 +70,7 @@ public class Bench { } else if (res instanceof Boolean) { result = res.toString(); } else { - result = res != null ? JsonProviderFactory.createProvider().toJson(res) : "null"; + result = res != null ? Configuration.defaultConfiguration().getProvider().toJson(res) : "null"; } return new Result("jayway", time, result, error); }