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

MockMvc PrintResultHandler asserts before result is set [SPR-12735] #17332

spring-issuemaster opened this issue Feb 20, 2015 · 0 comments


Copy link

@spring-issuemaster spring-issuemaster commented Feb 20, 2015

Dan Parrella opened SPR-12735 and commented

When running controller tests against endpoints that are asynchronous and using the PrintResultHandler, my tests always fail because the PrintResultHandler seems to attempt to print the result before it is available.

When the endpoint is asynchronous, I would expect that we wait to print until asyncDispatch(mvcResult) gets called or waiting some period of time before the result becomes available.

Example Code

final MvcResult mvcResult = getMockMvc().perform(post(<ASYNC_ENDPOINT>))


Stack Trace

java.lang.IllegalStateException: Async result for handler [public <HIDDEN>] was not set during the specified timeToWait=0
	at org.springframework.util.Assert.state(
	at org.springframework.test.web.servlet.DefaultMvcResult.getAsyncResult(
	at org.springframework.test.web.servlet.result.PrintingResultHandler.printAsyncResult(
	at org.springframework.test.web.servlet.result.PrintingResultHandler.handle(
	at org.springframework.test.web.servlet.MockMvc.applyDefaultResultActions(
	at org.springframework.test.web.servlet.MockMvc.perform(

Affects: 4.1.4

Referenced from: commits b4d9fb9, c48858c

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.