Polishing

This commit is contained in:
Sam Brannen 2018-03-30 12:23:28 +02:00
parent f79562f8d1
commit e5096be660
2 changed files with 4 additions and 12 deletions

View File

@ -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) { private boolean awaitAsyncDispatch(long timeout) {
Assert.state(this.asyncDispatchLatch != null, 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 { try {
return this.asyncDispatchLatch.await(timeout, TimeUnit.MILLISECONDS); return this.asyncDispatchLatch.await(timeout, TimeUnit.MILLISECONDS);
} }

View File

@ -13,17 +13,15 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.test.web.servlet; package org.springframework.test.web.servlet;
import java.util.concurrent.CountDownLatch; import java.util.concurrent.CountDownLatch;
import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletRequest;
import static org.junit.Assert.*;
/** /**
* Test fixture for {@link DefaultMvcResult}. * Test fixture for {@link DefaultMvcResult}.
* *
@ -31,13 +29,7 @@ import static org.junit.Assert.*;
*/ */
public class DefaultMvcResultTests { public class DefaultMvcResultTests {
private DefaultMvcResult mvcResult; private final DefaultMvcResult mvcResult = new DefaultMvcResult(new MockHttpServletRequest(), null);
@Before
public void setup() {
MockHttpServletRequest request = new MockHttpServletRequest();
this.mvcResult = new DefaultMvcResult(request, null);
}
@Test @Test
public void getAsyncResultSuccess() { public void getAsyncResultSuccess() {