Using Rest assured with a controller that produces a DeferredResult

177 views
Skip to first unread message

Matt Reynolds

unread,
May 9, 2016, 11:16:08 PM5/9/16
to REST assured
I have a Spring project using Java Rx Observables and a controller that returns a DeferredResult. When I test it with Rest assured using mockmvc, the response status code is 200 but the body is empty so any assertions fail. I can test the same code path with a ResponseEntity using toBlocking().first() on the Observable my service returns and all my rest assured assertions pass. I'm assuming this is because the mock doesn't know about the async nature of the response.

Is there any way to get rest assured to work with a DeferredResult?

Thanks

Johan Haleby

unread,
May 10, 2016, 2:51:45 AM5/10/16
to rest-a...@googlegroups.com
Hmm, have you tried using async? Besides that I'm not sure how to go about. 

--
You received this message because you are subscribed to the Google Groups "REST assured" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rest-assured...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Matt Reynolds

unread,
May 10, 2016, 11:31:46 AM5/10/16
to REST assured
Thanks Johan - I was too focused on searching for DeferredResult in the docs instead of looking for general async info. Adding async() works.

Johan Haleby

unread,
May 11, 2016, 2:23:06 AM5/11/16
to rest-a...@googlegroups.com
Thanks for letting us know that it works.
Reply all
Reply to author
Forward
0 new messages