Remove use of Optional in SyncHandlerMethodArgumentResolver

... and a couple more protected methods in WebFlux

Issue: SPR-15718
This commit is contained in:
Rossen Stoyanchev
2017-06-29 17:01:28 -04:00
parent 7de6cfa1df
commit 8f4eb23540
12 changed files with 66 additions and 78 deletions

View File

@@ -187,11 +187,11 @@ public class ControllerMethodResolverTests {
@Test
public void exceptionHandlerArgumentResolvers() throws Exception {
Optional<InvocableHandlerMethod> optional =
InvocableHandlerMethod invocable =
this.methodResolver.getExceptionHandlerMethod(
new ResponseStatusException(HttpStatus.BAD_REQUEST, "reason"), this.handlerMethod);
InvocableHandlerMethod invocable = optional.orElseThrow(() -> new AssertionError("No match"));
assertNotNull("No match", invocable);
assertEquals(TestController.class, invocable.getBeanType());
List<HandlerMethodArgumentResolver> resolvers = invocable.getResolvers();
@@ -221,11 +221,10 @@ public class ControllerMethodResolverTests {
@Test
public void exceptionHandlerFromControllerAdvice() throws Exception {
Optional<InvocableHandlerMethod> optional =
InvocableHandlerMethod invocable =
this.methodResolver.getExceptionHandlerMethod(
new IllegalStateException("reason"), this.handlerMethod);
InvocableHandlerMethod invocable = optional.orElseThrow(() -> new AssertionError("No match"));
assertNotNull(invocable);
assertEquals(TestControllerAdvice.class, invocable.getBeanType());
}
@@ -286,7 +285,7 @@ public class ControllerMethodResolverTests {
implements SyncHandlerMethodArgumentResolver {
@Override
public Optional<Object> resolveArgumentValue(MethodParameter p, BindingContext c, ServerWebExchange e) {
public Object resolveArgumentValue(MethodParameter p, BindingContext c, ServerWebExchange e) {
return null;
}
}