@ -1,5 +1,5 @@
@@ -1,5 +1,5 @@
/ *
* Copyright 2002 - 2013 the original author or authors .
* Copyright 2002 - 2017 the original author or authors .
*
* Licensed under the Apache License , Version 2 . 0 ( the "License" ) ;
* you may not use this file except in compliance with the License .
@ -28,12 +28,9 @@ import org.springframework.mock.web.test.MockHttpServletRequest;
@@ -28,12 +28,9 @@ import org.springframework.mock.web.test.MockHttpServletRequest;
import org.springframework.mock.web.test.MockHttpServletResponse ;
import org.springframework.web.context.request.NativeWebRequest ;
import static org.junit.Assert.assertEquals ;
import static org.junit.Assert.assertTrue ;
import static org.mockito.BDDMockito.given ;
import static org.mockito.BDDMockito.mock ;
import static org.mockito.BDDMockito.verify ;
import static org.springframework.web.context.request.async.CallableProcessingInterceptor.RESULT_NONE ;
import static org.junit.Assert.* ;
import static org.mockito.BDDMockito.* ;
import static org.springframework.web.context.request.async.CallableProcessingInterceptor.* ;
/ * *
* { @link WebAsyncManager } tests where container - triggered timeout / completion
@ -53,8 +50,9 @@ public class WebAsyncManagerTimeoutTests {
@@ -53,8 +50,9 @@ public class WebAsyncManagerTimeoutTests {
private MockHttpServletResponse servletResponse ;
@Before
public void setU p ( ) {
public void setu p ( ) {
this . servletRequest = new MockHttpServletRequest ( "GET" , "/test" ) ;
this . servletRequest . setAsyncSupported ( true ) ;
this . servletResponse = new MockHttpServletResponse ( ) ;
@ -67,9 +65,9 @@ public class WebAsyncManagerTimeoutTests {
@@ -67,9 +65,9 @@ public class WebAsyncManagerTimeoutTests {
this . asyncManager . setAsyncWebRequest ( this . asyncWebRequest ) ;
}
@Test
public void startCallableProcessingTimeoutAndComplete ( ) throws Exception {
StubCallable callable = new StubCallable ( ) ;
CallableProcessingInterceptor interceptor = mock ( CallableProcessingInterceptor . class ) ;
@ -92,7 +90,7 @@ public class WebAsyncManagerTimeoutTests {
@@ -92,7 +90,7 @@ public class WebAsyncManagerTimeoutTests {
public void startCallableProcessingTimeoutAndResumeThroughCallback ( ) throws Exception {
StubCallable callable = new StubCallable ( ) ;
WebAsyncTask < Object > webAsyncTask = new WebAsyncTask < Object > ( callable ) ;
WebAsyncTask < Object > webAsyncTask = new WebAsyncTask < > ( callable ) ;
webAsyncTask . onTimeout ( new Callable < Object > ( ) {
@Override
public Object call ( ) throws Exception {
@ -153,7 +151,7 @@ public class WebAsyncManagerTimeoutTests {
@@ -153,7 +151,7 @@ public class WebAsyncManagerTimeoutTests {
@Test
public void startDeferredResultProcessingTimeoutAndComplete ( ) throws Exception {
DeferredResult < Integer > deferredResult = new DeferredResult < Integer > ( ) ;
DeferredResult < Integer > deferredResult = new DeferredResult < > ( ) ;
DeferredResultProcessingInterceptor interceptor = mock ( DeferredResultProcessingInterceptor . class ) ;
given ( interceptor . handleTimeout ( this . asyncWebRequest , deferredResult ) ) . willReturn ( true ) ;
@ -175,7 +173,7 @@ public class WebAsyncManagerTimeoutTests {
@@ -175,7 +173,7 @@ public class WebAsyncManagerTimeoutTests {
@Test
public void startDeferredResultProcessingTimeoutAndResumeWithDefaultResult ( ) throws Exception {
DeferredResult < Integer > deferredResult = new DeferredResult < Integer > ( null , 23 ) ;
DeferredResult < Integer > deferredResult = new DeferredResult < > ( null , 23 ) ;
this . asyncManager . startDeferredResultProcessing ( deferredResult ) ;
AsyncEvent event = null ;
@ -189,7 +187,7 @@ public class WebAsyncManagerTimeoutTests {
@@ -189,7 +187,7 @@ public class WebAsyncManagerTimeoutTests {
@Test
public void startDeferredResultProcessingTimeoutAndResumeThroughCallback ( ) throws Exception {
final DeferredResult < Integer > deferredResult = new DeferredResult < Integer > ( ) ;
final DeferredResult < Integer > deferredResult = new DeferredResult < > ( ) ;
deferredResult . onTimeout ( new Runnable ( ) {
@Override
public void run ( ) {
@ -210,7 +208,7 @@ public class WebAsyncManagerTimeoutTests {
@@ -210,7 +208,7 @@ public class WebAsyncManagerTimeoutTests {
@Test
public void startDeferredResultProcessingTimeoutAndResumeThroughInterceptor ( ) throws Exception {
DeferredResult < Integer > deferredResult = new DeferredResult < Integer > ( ) ;
DeferredResult < Integer > deferredResult = new DeferredResult < > ( ) ;
DeferredResultProcessingInterceptor interceptor = new DeferredResultProcessingInterceptorAdapter ( ) {
@Override
@ -234,7 +232,7 @@ public class WebAsyncManagerTimeoutTests {
@@ -234,7 +232,7 @@ public class WebAsyncManagerTimeoutTests {
@Test
public void startDeferredResultProcessingAfterTimeoutException ( ) throws Exception {
DeferredResult < Integer > deferredResult = new DeferredResult < Integer > ( ) ;
DeferredResult < Integer > deferredResult = new DeferredResult < > ( ) ;
final Exception exception = new Exception ( ) ;
DeferredResultProcessingInterceptor interceptor = new DeferredResultProcessingInterceptorAdapter ( ) {