Browse Source

replace usage of JsonProviderFactory in other modules

pull/48/head
Jochen Berger 10 years ago
parent
commit
0289ac00c4
  1. 8
      json-path-assert/src/main/java/com/jayway/jsonassert/JsonAssert.java
  2. 3
      json-path-web-test/src/main/java/com/jayway/jsonpath/web/bench/Bench.java

8
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.IsEmptyCollection;
import com.jayway.jsonassert.impl.matcher.IsMapContainingKey; import com.jayway.jsonassert.impl.matcher.IsMapContainingKey;
import com.jayway.jsonassert.impl.matcher.IsMapContainingValue; 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 org.hamcrest.Matcher;
import java.io.IOException; import java.io.IOException;
@ -30,7 +32,7 @@ public class JsonAssert {
* @throws ParseException when the given JSON could not be parsed * @throws ParseException when the given JSON could not be parsed
*/ */
public static JsonAsserter with(String json) { 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 * @throws ParseException when the given JSON could not be parsed
*/ */
public static JsonAsserter with(Reader reader) throws IOException { public static JsonAsserter with(Reader reader) throws IOException {
return new JsonAsserterImpl(JsonProviderFactory.createProvider().parse(convertReaderToString(reader))); return new JsonAsserterImpl(JsonPath.parse(convertReaderToString(reader)).json());
} }

3
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.JsonPath;
import com.jayway.jsonpath.Option; import com.jayway.jsonpath.Option;
import com.jayway.jsonpath.internal.spi.json.JacksonProvider; import com.jayway.jsonpath.internal.spi.json.JacksonProvider;
import com.jayway.jsonpath.spi.json.JsonProviderFactory;
import io.gatling.jsonpath.JsonPath$; import io.gatling.jsonpath.JsonPath$;
import org.boon.json.JsonParser; import org.boon.json.JsonParser;
import org.boon.json.ObjectMapper; import org.boon.json.ObjectMapper;
@ -71,7 +70,7 @@ public class Bench {
} else if (res instanceof Boolean) { } else if (res instanceof Boolean) {
result = res.toString(); result = res.toString();
} else { } 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); return new Result("jayway", time, result, error);
} }

Loading…
Cancel
Save