Upgrade json-path to 0.9.0 version

This version fixed bugs and improved performance.
New features: "select multiple attributes" and
"Array operations and slicing improved" (a new example
has been added in tests to reflect that).

See https://github.com/jayway/JsonPath/blob/master/README

Issue: SPR-10990
This commit is contained in:
Brian Clozel 2013-10-17 14:28:44 +02:00 committed by Rossen Stoyanchev
parent 79048e18be
commit efa86e80d8
2 changed files with 8 additions and 5 deletions

View File

@ -756,7 +756,7 @@ project("spring-test") {
optional(project(":spring-orm"))
optional(project(":spring-web"))
optional(project(":spring-webmvc"))
optional(project(":spring-webmvc-portlet"), )
optional(project(":spring-webmvc-portlet"))
optional("junit:junit:${junitVersion}")
optional("org.testng:testng:6.8.5")
optional("javax.servlet:javax.servlet-api:3.0.1")
@ -799,9 +799,10 @@ project("spring-test-mvc") {
dependencies {
optional(project(":spring-context"))
provided(project(":spring-webmvc"))
provided(project(":spring-webmvc-tiles3"))
provided("javax.servlet:javax.servlet-api:3.0.1")
optional("org.hamcrest:hamcrest-core:1.3")
optional("com.jayway.jsonpath:json-path:0.8.1")
optional("com.jayway.jsonpath:json-path:0.9.0")
optional("xmlunit:xmlunit:1.3")
testCompile("org.slf4j:slf4j-jcl:${slf4jVersion}")
testCompile("javax.servlet:jstl:1.2")

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -18,6 +18,7 @@ package org.springframework.test.web.client.samples.matchers;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.endsWith;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.hasItem;
import static org.hamcrest.Matchers.isIn;
import static org.hamcrest.Matchers.startsWith;
import static org.springframework.test.web.client.match.MockRestRequestMatchers.content;
@ -92,8 +93,8 @@ public class JsonPathRequestMatcherTests {
public void testDoesNotExist() throws Exception {
this.mockServer.expect(requestTo("/composers"))
.andExpect(content().contentType("application/json;charset=UTF-8"))
.andExpect(jsonPath("$.composers[?(@.name = 'Edvard Grieeeeeeg')]").doesNotExist())
.andExpect(jsonPath("$.composers[?(@.name = 'Robert Schuuuuuuman')]").doesNotExist())
.andExpect(jsonPath("$.composers[?(@.name == 'Edvard Grieeeeeeg')]").doesNotExist())
.andExpect(jsonPath("$.composers[?(@.name == 'Robert Schuuuuuuman')]").doesNotExist())
.andExpect(jsonPath("$.composers[-1]").doesNotExist())
.andExpect(jsonPath("$.composers[4]").doesNotExist())
.andRespond(withSuccess());
@ -124,6 +125,7 @@ public class JsonPathRequestMatcherTests {
.andExpect(jsonPath("$.performers[0].name", endsWith("Ashkenazy")))
.andExpect(jsonPath("$.performers[1].name", containsString("di Me")))
.andExpect(jsonPath("$.composers[1].name", isIn(Arrays.asList("Johann Sebastian Bach", "Johannes Brahms"))))
.andExpect(jsonPath("$.composers[:3].name", hasItem("Johannes Brahms")))
.andRespond(withSuccess());
this.restTemplate.put(new URI("/composers"), this.people);