-
Notifications
You must be signed in to change notification settings - Fork 38.5k
MockMvcResultMatchers.jsonPath(String).value() should have a matching method to declare the expected type [SPR-14498] #19067
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
Comments
Sam Brannen commented FYI: This is very closely related (identical?) to a discussion on Stack Overflow. |
Rossen Stoyanchev commented Currently we use Sam Brannen what do you think? JsonPathExpectationsHelper currently accepts the expression as a constructor arg but whatever benefit there is, it makes no difference when used through MockMvcResultMatchers which creates a new JsonPathExpectationsHelper instance every time. So in JsonPathExpectationsHelper we could simply cache the expression and then call |
Sam Brannen commented I agree with your proposal. That sounds like the best course of action. By default, JsonPath will use the |
Rossen Stoyanchev commented See commit 7fdb89 for the resulting fix. |
Sam Brannen commented Great work! (y) |
Juergen Hoeller commented Looks good to me. I'll backport it right away since I'm wrapping up other stuff on 4.3.x at the moment anyway :-) |
Sam Brannen commented Thanks, Juergen Hoeller |
Sam Brannen commented Thanks to a comment on Stack Overflow, I just noticed that... The explicit Oops! I'll address that in a new issue. |
Sam Brannen commented See #21129 |
Chris Mercer opened SPR-14498 and commented
Java
Double
instances will sometimes be converted from "12.0" to "12" in JSON based on rules/Jackson configuration.While reading the results back in testing, JsonPath will convert the "JSON number" to an
Integer
.There should be an additional "value" method that accepts the target type for JsonPath to convert to.
Affects: 4.2.5
Issue Links:
Referenced from: commits 2c2ce55, 7fdb892, 68463e2, d09b0fe
The text was updated successfully, but these errors were encountered: