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
Add Kotlin DSL support for MockMVC andExpectAll #29727
Merged
simonbasle
merged 2 commits into
spring-projects:main
from
simonbasle:27317-kotlinAndExpectAll
Jan 3, 2023
Merged
Add Kotlin DSL support for MockMVC andExpectAll #29727
simonbasle
merged 2 commits into
spring-projects:main
from
simonbasle:27317-kotlinAndExpectAll
Jan 3, 2023
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
As the DSL internally calls ResultActions.andExpect, this is done with a trick where a synthetic ResultActions is provided at top level which stores each ResultMatcher in a mutable list. Once the DSL usage is done, the top level DSL andExpectAll turns that list into a vararg passed down to the actual `actions.andExpectAll`. Fixes spring-projectsgh-27317.
simonbasle
added
theme: kotlin
An issue related to Kotlin support
in: test
Issues in the test module
type: enhancement
A general enhancement
labels
Dec 21, 2022
sdeleuze
approved these changes
Jan 3, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks a fine way to solve this non trivial issue, please just check the few comments I added.
spring-test/src/main/kotlin/org/springframework/test/web/servlet/MockMvcResultMatchersDsl.kt
Show resolved
Hide resolved
spring-test/src/main/kotlin/org/springframework/test/web/servlet/ResultActionsDsl.kt
Show resolved
Hide resolved
spring-test/src/main/kotlin/org/springframework/test/web/servlet/MockMvcResultMatchersDsl.kt
Show resolved
Hide resolved
spring-test/src/main/kotlin/org/springframework/test/web/servlet/ResultActionsDsl.kt
Show resolved
Hide resolved
oops I've overlooked the documentation deliverable mentioned in gh-27317 😞 will do a follow-up |
simonbasle
added a commit
to simonbasle/spring-framework
that referenced
this pull request
Jan 4, 2023
…e manual This just adds a Kotlin snippet alongside the Java snippet in the reference manual. Relates to spring-projectsgh-29727 Closes spring-projectsgh-27317
2 tasks
simonbasle
added a commit
that referenced
this pull request
Jan 4, 2023
mdeinum
pushed a commit
to mdeinum/spring-framework
that referenced
this pull request
Jun 29, 2023
As the DSL internally calls `ResultActions.andExpect`, this is done with a trick where a synthetic `ResultActions` is provided at top level which stores each `ResultMatcher` in a mutable list. Once the DSL usage is done, the top level DSL `andExpectAll` turns that list into a `vararg` passed down to the actual `actions.andExpectAll`. Closes spring-projectsgh-27317
mdeinum
pushed a commit
to mdeinum/spring-framework
that referenced
this pull request
Jun 29, 2023
…e manual (spring-projects#29766) This just adds a Kotlin snippet alongside the Java snippet in the reference manual. Relates to spring-projectsgh-29727 Closes spring-projectsgh-27317
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
in: test
Issues in the test module
theme: kotlin
An issue related to Kotlin support
type: enhancement
A general enhancement
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As the DSL internally calls
ResultActions.andExpect
, this is done with a trick where a syntheticResultActions
is provided at top level which stores eachResultMatcher
in a mutable list. Once the DSL usage is done, the top level DSLandExpectAll
turns that list into avararg
passed down to the actualactions.andExpectAll
.Closes gh-27317