@ -52,10 +52,8 @@ import org.springframework.web.server.handler.ExceptionHandlingWebHandler;
@@ -52,10 +52,8 @@ import org.springframework.web.server.handler.ExceptionHandlingWebHandler;
import static org.hamcrest.CoreMatchers.instanceOf ;
import static org.hamcrest.CoreMatchers.startsWith ;
import static org.hamcrest.Matchers.is ;
import static org.junit.Assert.assertEquals ;
import static org.junit.Assert.assertSame ;
import static org.junit.Assert.assertThat ;
import static org.springframework.http.MediaType.APPLICATION_JSON ;
import static org.junit.Assert.* ;
import static org.springframework.http.MediaType.* ;
/ * *
* Test the effect of exceptions at different stages of request processing by
@ -72,7 +70,7 @@ public class DispatcherHandlerErrorTests {
@@ -72,7 +70,7 @@ public class DispatcherHandlerErrorTests {
@Before
public void setup ( ) throws Exception {
public void setup ( ) {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext ( ) ;
ctx . register ( TestConfig . class ) ;
ctx . refresh ( ) ;
@ -81,7 +79,7 @@ public class DispatcherHandlerErrorTests {
@@ -81,7 +79,7 @@ public class DispatcherHandlerErrorTests {
@Test
public void noHandler ( ) throws Exception {
public void noHandler ( ) {
MockServerWebExchange exchange = MockServerWebExchange . from ( MockServerHttpRequest . get ( "/does-not-exist" ) ) ;
Mono < Void > publisher = this . dispatcherHandler . handle ( exchange ) ;
@ -95,7 +93,7 @@ public class DispatcherHandlerErrorTests {
@@ -95,7 +93,7 @@ public class DispatcherHandlerErrorTests {
}
@Test
public void controllerReturnsMonoError ( ) throws Exception {
public void controllerReturnsMonoError ( ) {
MockServerWebExchange exchange = MockServerWebExchange . from ( MockServerHttpRequest . get ( "/error-signal" ) ) ;
Mono < Void > publisher = this . dispatcherHandler . handle ( exchange ) ;
@ -105,7 +103,7 @@ public class DispatcherHandlerErrorTests {
@@ -105,7 +103,7 @@ public class DispatcherHandlerErrorTests {
}
@Test
public void controllerThrowsException ( ) throws Exception {
public void controllerThrowsException ( ) {
MockServerWebExchange exchange = MockServerWebExchange . from ( MockServerHttpRequest . get ( "/raise-exception" ) ) ;
Mono < Void > publisher = this . dispatcherHandler . handle ( exchange ) ;
@ -115,7 +113,7 @@ public class DispatcherHandlerErrorTests {
@@ -115,7 +113,7 @@ public class DispatcherHandlerErrorTests {
}
@Test
public void unknownReturnType ( ) throws Exception {
public void unknownReturnType ( ) {
MockServerWebExchange exchange = MockServerWebExchange . from ( MockServerHttpRequest . get ( "/unknown-return-type" ) ) ;
Mono < Void > publisher = this . dispatcherHandler . handle ( exchange ) ;
@ -128,7 +126,7 @@ public class DispatcherHandlerErrorTests {
@@ -128,7 +126,7 @@ public class DispatcherHandlerErrorTests {
}
@Test
public void responseBodyMessageConversionError ( ) throws Exception {
public void responseBodyMessageConversionError ( ) {
ServerWebExchange exchange = MockServerWebExchange . from (
MockServerHttpRequest . post ( "/request-body" ) . accept ( APPLICATION_JSON ) . body ( "body" ) ) ;
@ -140,7 +138,7 @@ public class DispatcherHandlerErrorTests {
@@ -140,7 +138,7 @@ public class DispatcherHandlerErrorTests {
}
@Test
public void requestBodyError ( ) throws Exception {
public void requestBodyError ( ) {
ServerWebExchange exchange = MockServerWebExchange . from (
MockServerHttpRequest . post ( "/request-body" ) . body ( Mono . error ( EXCEPTION ) ) ) ;
@ -152,7 +150,7 @@ public class DispatcherHandlerErrorTests {
@@ -152,7 +150,7 @@ public class DispatcherHandlerErrorTests {
}
@Test
public void webExceptionHandler ( ) throws Exception {
public void webExceptionHandler ( ) {
ServerWebExchange exchange = MockServerWebExchange . from ( MockServerHttpRequest . get ( "/unknown-argument-type" ) ) ;
List < WebExceptionHandler > handlers = Collections . singletonList ( new ServerError500ExceptionHandler ( ) ) ;
@ -202,12 +200,12 @@ public class DispatcherHandlerErrorTests {
@@ -202,12 +200,12 @@ public class DispatcherHandlerErrorTests {
}
@RequestMapping ( "/raise-exception" )
public void raiseException ( ) throws Exception {
public void raiseException ( ) {
throw EXCEPTION ;
}
@RequestMapping ( "/unknown-return-type" )
public Foo unknownReturnType ( ) throws Exception {
public Foo unknownReturnType ( ) {
return new Foo ( ) ;
}