Skip to content
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

WebTestClient.bindToRouterFunction(...) with exception handler not working [SPR-17239] #21772

Closed
spring-projects-issues opened this issue Sep 3, 2018 · 1 comment
Assignees
Labels
in: test in: web type: enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

@spring-projects-issues spring-projects-issues commented Sep 3, 2018

rodolphocouto opened SPR-17239 and commented

This bug occurs when the WebTestClient is used to test a router function with custom exception handler, for example:

 

WebTestClient
    .bindToRouterFunction(myRouter())
    .handlerStrategies(HandlerStrategies.builder()
        .exceptionHandler(new CustomExceptionHandler()) // IS NOT CALLED :(
        .build())
    .build()

 

 

With annotated controllers, the same custom exception is called, for example:

 

WebTestClient
    .bindToController(new MyController())
    .controllerAdvice(new CustomExceptionHandler()) // IS CALLED :)
    .build()

 


Affects: 5.0.8

Reference URL: https://github.com/rodolphocouto/spring-framework-issues/tree/master/SPR-17239

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Oct 12, 2018

Rossen Stoyanchev commented

Looks like several options in HandlerStrategies were added later, but bindToRouterFunction was never updated. This should be fixed now in master for 5.1.1.

@spring-projects-issues spring-projects-issues added in: test type: enhancement in: web labels Jan 11, 2019
@spring-projects-issues spring-projects-issues added this to the 5.1.1 milestone Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: test in: web type: enhancement
Projects
None yet
Development

No branches or pull requests

2 participants