diff --git a/spring-test/src/main/java/org/springframework/test/web/servlet/DefaultMvcResult.java b/spring-test/src/main/java/org/springframework/test/web/servlet/DefaultMvcResult.java index 5e5ec0a4e57..3157b191441 100644 --- a/spring-test/src/main/java/org/springframework/test/web/servlet/DefaultMvcResult.java +++ b/spring-test/src/main/java/org/springframework/test/web/servlet/DefaultMvcResult.java @@ -151,11 +151,11 @@ class DefaultMvcResult implements MvcResult { } /** - * True if is there a latch was not set, or the latch count reached 0. + * True if the latch count reached 0 within the specified timeout. */ private boolean awaitAsyncDispatch(long timeout) { Assert.state(this.asyncDispatchLatch != null, - "The asynDispatch CountDownLatch was not set by the TestDispatcherServlet.\n"); + "The asyncDispatch CountDownLatch was not set by the TestDispatcherServlet.\n"); try { return this.asyncDispatchLatch.await(timeout, TimeUnit.MILLISECONDS); } diff --git a/spring-test/src/test/java/org/springframework/test/web/servlet/DefaultMvcResultTests.java b/spring-test/src/test/java/org/springframework/test/web/servlet/DefaultMvcResultTests.java index 87f75b1479e..cc41fb26469 100644 --- a/spring-test/src/test/java/org/springframework/test/web/servlet/DefaultMvcResultTests.java +++ b/spring-test/src/test/java/org/springframework/test/web/servlet/DefaultMvcResultTests.java @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.test.web.servlet; import java.util.concurrent.CountDownLatch; -import org.junit.Before; import org.junit.Test; import org.springframework.mock.web.MockHttpServletRequest; -import static org.junit.Assert.*; - /** * Test fixture for {@link DefaultMvcResult}. * @@ -31,13 +29,7 @@ import static org.junit.Assert.*; */ public class DefaultMvcResultTests { - private DefaultMvcResult mvcResult; - - @Before - public void setup() { - MockHttpServletRequest request = new MockHttpServletRequest(); - this.mvcResult = new DefaultMvcResult(request, null); - } + private final DefaultMvcResult mvcResult = new DefaultMvcResult(new MockHttpServletRequest(), null); @Test public void getAsyncResultSuccess() {