Skip to content

Commit 6842fd7

Browse files
committed
Ensure result ready in asyncDispatch in MockMvc
Issue: SPR-13079
1 parent 289f35d commit 6842fd7

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

spring-test/src/main/java/org/springframework/test/web/servlet/request/MockMvcRequestBuilders.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2014 the original author or authors.
2+
* Copyright 2002-2015 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -221,6 +221,10 @@ public static MockMultipartHttpServletRequestBuilder fileUpload(URI uri) {
221221
* @param mvcResult the result from the request that started async processing
222222
*/
223223
public static RequestBuilder asyncDispatch(final MvcResult mvcResult) {
224+
225+
// There must be an async result before dispatching
226+
mvcResult.getAsyncResult();
227+
224228
return new RequestBuilder() {
225229
@Override
226230
public MockHttpServletRequest buildRequest(ServletContext servletContext) {

0 commit comments

Comments
 (0)