use of com.jayway.jsonpath.spi.json.JacksonJsonProvider in project JsonPath by json-path.
the class JsonProviderTest method parse_array.
@Test
public void parse_array() throws Exception {
JacksonJsonProvider provider = new JacksonJsonProvider();
Object o = provider.parse(ARRAY);
}
use of com.jayway.jsonpath.spi.json.JacksonJsonProvider in project syndesis by syndesisio.
the class AbstractSwaggerConnectorTest method fetchSwaggerConnectorTemplateFromDeployment.
private static ConnectorTemplate fetchSwaggerConnectorTemplateFromDeployment() {
final Configuration configuration = //
Configuration.builder().jsonProvider(//
new JacksonJsonProvider(Json.copyObjectMapperConfiguration())).mappingProvider(//
new JacksonMappingProvider(Json.copyObjectMapperConfiguration())).build();
final List<ConnectorTemplate> templates = JsonPath.using(configuration).parse(AbstractSwaggerConnectorTest.class.getResourceAsStream("/io/syndesis/server/dao/deployment.json")).read("$..[?(@['id'] == 'swagger-connector-template')]", new TypeRef<List<ConnectorTemplate>>() {
});
return templates.get(0);
}
use of com.jayway.jsonpath.spi.json.JacksonJsonProvider in project JsonPath by jayway.
the class TestSuppressExceptions method testSuppressExceptionsIsRespectedPath.
@Test
public void testSuppressExceptionsIsRespectedPath() {
ParseContext parseContext = JsonPath.using(new Configuration.ConfigurationBuilder().jsonProvider(new JacksonJsonProvider()).mappingProvider(new JacksonMappingProvider()).options(Option.SUPPRESS_EXCEPTIONS, Option.AS_PATH_LIST).build());
String json = "{}";
List<String> result = parseContext.parse(json).read(JsonPath.compile("$.missing"));
assertThat(result).isEmpty();
}
use of com.jayway.jsonpath.spi.json.JacksonJsonProvider in project JsonPath by jayway.
the class TestSuppressExceptions method testSuppressExceptionsIsRespected.
@Test
public void testSuppressExceptionsIsRespected() {
ParseContext parseContext = JsonPath.using(new Configuration.ConfigurationBuilder().jsonProvider(new JacksonJsonProvider()).mappingProvider(new JacksonMappingProvider()).options(Option.SUPPRESS_EXCEPTIONS).build());
String json = "{}";
assertNull(parseContext.parse(json).read(JsonPath.compile("$.missing")));
}
use of com.jayway.jsonpath.spi.json.JacksonJsonProvider in project JsonPath by jayway.
the class ProviderInTest method testJsonPathQuotesJackson.
@Test
public void testJsonPathQuotesJackson() throws Exception {
final Configuration jackson = Configuration.builder().jsonProvider(new JacksonJsonProvider()).mappingProvider(new JacksonMappingProvider()).build();
final DocumentContext ctx = JsonPath.using(jackson).parse(JSON);
final List<String> doubleQuoteEqualsResult = ctx.read(DOUBLE_QUOTES_EQUALS_FILTER);
assertEquals(Lists.newArrayList("bar"), doubleQuoteEqualsResult);
final List<String> singleQuoteEqualsResult = ctx.read(SINGLE_QUOTES_EQUALS_FILTER);
assertEquals(doubleQuoteEqualsResult, singleQuoteEqualsResult);
final List<String> doubleQuoteInResult = ctx.read(DOUBLE_QUOTES_IN_FILTER);
assertEquals(doubleQuoteInResult, doubleQuoteEqualsResult);
final List<String> singleQuoteInResult = ctx.read(SINGLE_QUOTES_IN_FILTER);
assertEquals(doubleQuoteInResult, singleQuoteInResult);
}
Aggregations