Ensure result ready in asyncDispatch in MockMvc

Issue: SPR-13079
This commit is contained in:
Rossen Stoyanchev 2015-06-25 05:01:39 -04:00
parent 289f35da3a
commit 6842fd7fb9
1 changed files with 5 additions and 1 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2014 the original author or authors. * Copyright 2002-2015 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -221,6 +221,10 @@ public abstract class MockMvcRequestBuilders {
* @param mvcResult the result from the request that started async processing * @param mvcResult the result from the request that started async processing
*/ */
public static RequestBuilder asyncDispatch(final MvcResult mvcResult) { public static RequestBuilder asyncDispatch(final MvcResult mvcResult) {
// There must be an async result before dispatching
mvcResult.getAsyncResult();
return new RequestBuilder() { return new RequestBuilder() {
@Override @Override
public MockHttpServletRequest buildRequest(ServletContext servletContext) { public MockHttpServletRequest buildRequest(ServletContext servletContext) {