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

Make DeferredResult testable [SPR-9690] #14324

Closed
spring-projects-issues opened this issue Aug 15, 2012 · 5 comments
Closed

Make DeferredResult testable [SPR-9690] #14324

spring-projects-issues opened this issue Aug 15, 2012 · 5 comments
Assignees
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

Anders Wallgren opened SPR-9690 and commented

To facilitate mocking during unit testing, DeferredResult should be an interface, not a class.


Affects: 3.2 M1

@spring-projects-issues
Copy link
Collaborator Author

Rossen Stoyanchev commented

Can you elaborate what you're trying to test? I don't quite see how an interface helps.

@spring-projects-issues
Copy link
Collaborator Author

Rossen Stoyanchev commented

Never mind, my guess is you want to test some code that sets a DeferredResult instance but feel free to comment if not so.

@spring-projects-issues
Copy link
Collaborator Author

Anders Wallgren commented

Exactly: I want to verify that, for example, DeferredResult.set is invoked with the expected object.

@spring-projects-issues
Copy link
Collaborator Author

Rossen Stoyanchev commented

Modified title (was: "org.springframework.web.context.request.async.DeferredResult should be an interface") to reflect the goal.

@spring-projects-issues
Copy link
Collaborator Author

Rossen Stoyanchev commented

DeferredResult now has a public method setResultHandler(DeferredResultHandler). That makes it possible to test what a DeferredResult was set to. I've added a test to that extent to spring-mvc-chat sample.

@spring-projects-issues spring-projects-issues added type: enhancement A general enhancement in: web Issues in web modules (web, webmvc, webflux, websocket) labels Jan 11, 2019
@spring-projects-issues spring-projects-issues added this to the 3.2 M2 milestone Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants