Search in sources :

Example 1 with ParseContext

use of com.jayway.jsonpath.ParseContext in project spring-data-commons by spring-projects.

the class ProjectionIntegrationTests method jacksonSerializationDoesNotExposeDecoratedClass.

// DATACMNS-909
@Test
public void jacksonSerializationDoesNotExposeDecoratedClass() throws Exception {
    ProxyProjectionFactory factory = new ProxyProjectionFactory();
    SampleProjection projection = factory.createProjection(SampleProjection.class);
    ParseContext context = JsonPath.using(new ConfigurationBuilder().options(Option.SUPPRESS_EXCEPTIONS).build());
    DocumentContext json = context.parse(new ObjectMapper().writeValueAsString(projection));
    assertThat(json.read("$.decoratedClass", String.class)).isNull();
}
Also used : ConfigurationBuilder(com.jayway.jsonpath.Configuration.ConfigurationBuilder) ParseContext(com.jayway.jsonpath.ParseContext) DocumentContext(com.jayway.jsonpath.DocumentContext) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Test(org.junit.Test)

Aggregations

ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 ConfigurationBuilder (com.jayway.jsonpath.Configuration.ConfigurationBuilder)1 DocumentContext (com.jayway.jsonpath.DocumentContext)1 ParseContext (com.jayway.jsonpath.ParseContext)1 Test (org.junit.Test)1