Skip to content

Conversation

simonbasle
Copy link
Contributor

@simonbasle simonbasle commented Dec 21, 2022

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 gh-27317

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 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
@simonbasle simonbasle self-assigned this Dec 21, 2022
@simonbasle simonbasle requested a review from a team December 21, 2022 16:12
@simonbasle simonbasle requested a review from sdeleuze January 2, 2023 17:28
Copy link
Contributor

@sdeleuze sdeleuze left a 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.

@simonbasle simonbasle added this to the 6.0.4 milestone Jan 3, 2023
@simonbasle simonbasle merged commit 74f5819 into spring-projects:main Jan 3, 2023
@simonbasle simonbasle deleted the 27317-kotlinAndExpectAll branch January 3, 2023 17:26
@simonbasle
Copy link
Contributor Author

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
simonbasle added a commit that referenced this pull request Jan 4, 2023
This just adds a Kotlin snippet alongside the Java snippet in the
reference manual.

Relates to gh-29727
Closes gh-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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Introduce Kotlin DSL for ResultActions.andExpectAll()
2 participants