Skip to content

Conversation

blake-bauman
Copy link
Contributor

Add a Principal for MockServerWebExchange.Builder to allow for a mock Principal object to be used with unit tests.

Add a Principal for MockServerWebExchange.Builder to allow for
a mock Principal object to be used with unit tests

Signed-off-by: blake_bauman <[email protected]>
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Apr 21, 2025
@blake-bauman
Copy link
Contributor Author

Use case: If the class you're testing makes a call to exchange.getPrincipal() the current MockServerWebExchange will only ever return Mono.empty().

@rstoyanchev rstoyanchev self-assigned this Apr 22, 2025
@rstoyanchev rstoyanchev added in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Apr 22, 2025
@rstoyanchev rstoyanchev added this to the 6.2.7 milestone Apr 22, 2025
Copy link
Contributor

@rstoyanchev rstoyanchev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We made a similar change in 6.2.5 to allow setting the ApplicationContext. We can add this as well.

@rstoyanchev rstoyanchev changed the title Adds option for Principal in MockServerWebExchange Adds option to set Principal in MockServerWebExchange Apr 22, 2025
rstoyanchev pushed a commit that referenced this pull request Apr 25, 2025
@sbrannen sbrannen added the in: test Issues in the test module label May 15, 2025
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 in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants