-
Notifications
You must be signed in to change notification settings - Fork 37.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce additional JsonPath matchers in Spring MVC Test [SPR-13320] #17905
Comments
Craig commented isObject doesn't make too much sense to me as the test would actually be for a Map... I suppose this difference is one of the confusing ways in which loosely typed Javascript/JSON differs from strongly typed Java. Since it made more sense to me, I named the method "isMap" Here's a pull request resolving this issue: |
Sam Brannen commented Completed in GitHub commit 35dd307:
|
Stéphane Nicoll commented This actually broke Spring Boot. in
@Test
public void trace() throws Exception {
this.mockMvc
.perform(get("/trace").accept(MediaType.APPLICATION_JSON))
.andExpect(status().isOk())
.andExpect(jsonPath("$._links.self.href").value("http://localhost/trace"))
.andExpect(jsonPath("$.content").isArray());
}
FYI, the output of the service is the following {"content":[],"_links":{"self":{"href":"http://localhost/trace","templated":false}}} Sam, this prevents us from upgrading to Spring Framework 4.2.1 snapshots. |
Sam Brannen commented Revised in additional GitHub commit 5a05cdb:
|
Sam Brannen commented If you're following this issue, you will likely be interested in the following issues as well. |
Sam Brannen commented Additional work performed in GitHub commit 4799668:
|
Martin Meyer opened SPR-13320 and commented
Status Quo
JsonPathResultMatchers
currently has the followingResultMatcher
methods.value(Object)
value(Matcher)
doesNotExist()
exists()
isArray()
Proposal
It would be beneficial to introduce the following.
isBoolean()
isNumber()
isObject()
isString()
Affects: 3.2 GA
Issue Links:
Referenced from: pull request #854
The text was updated successfully, but these errors were encountered: