Skip to content

Update @RestClientTest to work with WebClient #8404

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

Closed
snicoll opened this issue Feb 24, 2017 · 6 comments
Closed

Update @RestClientTest to work with WebClient #8404

snicoll opened this issue Feb 24, 2017 · 6 comments
Labels
status: declined A suggestion or change that we don't feel we should currently apply type: enhancement A general enhancement

Comments

@snicoll
Copy link
Member

snicoll commented Feb 24, 2017

If WebFlux is on the classpath it would be cool if MockRestServiceServer could be configured with a WebClientinstred of a RestTemplate.

Since both will be on the classpath (RestTemplate is in a shared module), the annotation should probably have an attribute to indicate a preference. Not sure that both can be used at the same time though.

@RestClientTest(useWebClient=true)

An enum will be better but I can't find good names for the values (REST_TEMPLATE is pretty gross).

This currently requires some changes in Spring Framework, I've created an issue

@snicoll snicoll added status: blocked An issue that's blocked on an external project change theme: webflux type: enhancement A general enhancement labels Feb 24, 2017
@snicoll snicoll self-assigned this Feb 24, 2017
@snicoll snicoll removed their assignment Apr 7, 2017
@philwebb philwebb added this to the 2.x milestone Feb 1, 2019
@mickaeltr
Copy link

Hello,

Does anyone has any update on this one?

I was about to migrate my code to WebClient as recommended, because RestTemplate / OAuth2RestTemplate are in maintenance mode… but the lack of testing support makes it inconvenient in the end.

Using MockWebServer is an option, but it's not as elegant as RestClientTest.

Thanks

@wilkinsona
Copy link
Member

wilkinsona commented May 18, 2020

The Spring Framework team have declined the issue that was blocking this one. Their recommendation is to use MockWebServer. Given that's the situation, there's nothing that was can do here.

@wilkinsona wilkinsona removed this from the 2.x milestone May 18, 2020
@wilkinsona wilkinsona added the status: declined A suggestion or change that we don't feel we should currently apply label May 18, 2020
@mickaeltr
Copy link

Thanks for the insight @wilkinsona

@jbotuck

This comment was marked as off-topic.

@philwebb philwebb changed the title Update @RestClientTest to work with WebClient Update @RestClientTest to work with WebClient May 8, 2023
@philwebb

This comment was marked as outdated.

@jbotuck
Copy link

jbotuck commented May 8, 2023

Sorry if I'm having trouble navigating this. This wasn't a question as much as a feature request. The current issue concludes with : won't support a test slice for webclient since the spring mock Web server doesn't support webclient

I'm here to ask for a test slice that uses okhttp mock server instead.

This might be worthy of its own GitHub issue, but as you saw, I tried that already.

@philwebb philwebb added the for: team-meeting An issue we'd like to discuss as a team to make progress label May 9, 2023
@philwebb philwebb removed the for: team-meeting An issue we'd like to discuss as a team to make progress label May 17, 2023
@snicoll snicoll removed the status: blocked An issue that's blocked on an external project change label Aug 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: declined A suggestion or change that we don't feel we should currently apply type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

5 participants