Search in sources :

Example 6 with HandlerMethodArgumentResolver

use of org.springframework.web.reactive.result.method.HandlerMethodArgumentResolver in project spring-framework by spring-projects.

the class ControllerMethodResolverTests method exceptionHandlerArgumentResolvers.

@Test
public void exceptionHandlerArgumentResolvers() {
    InvocableHandlerMethod invocable = this.methodResolver.getExceptionHandlerMethod(new ResponseStatusException(HttpStatus.BAD_REQUEST, "reason"), this.handlerMethod);
    assertThat(invocable).as("No match").isNotNull();
    assertThat(invocable.getBeanType()).isEqualTo(TestController.class);
    List<HandlerMethodArgumentResolver> resolvers = invocable.getResolvers();
    AtomicInteger index = new AtomicInteger(-1);
    assertThat(next(resolvers, index).getClass()).isEqualTo(RequestParamMethodArgumentResolver.class);
    assertThat(next(resolvers, index).getClass()).isEqualTo(RequestParamMapMethodArgumentResolver.class);
    assertThat(next(resolvers, index).getClass()).isEqualTo(PathVariableMethodArgumentResolver.class);
    assertThat(next(resolvers, index).getClass()).isEqualTo(PathVariableMapMethodArgumentResolver.class);
    assertThat(next(resolvers, index).getClass()).isEqualTo(MatrixVariableMethodArgumentResolver.class);
    assertThat(next(resolvers, index).getClass()).isEqualTo(MatrixVariableMapMethodArgumentResolver.class);
    assertThat(next(resolvers, index).getClass()).isEqualTo(RequestHeaderMethodArgumentResolver.class);
    assertThat(next(resolvers, index).getClass()).isEqualTo(RequestHeaderMapMethodArgumentResolver.class);
    assertThat(next(resolvers, index).getClass()).isEqualTo(CookieValueMethodArgumentResolver.class);
    assertThat(next(resolvers, index).getClass()).isEqualTo(ExpressionValueMethodArgumentResolver.class);
    assertThat(next(resolvers, index).getClass()).isEqualTo(SessionAttributeMethodArgumentResolver.class);
    assertThat(next(resolvers, index).getClass()).isEqualTo(RequestAttributeMethodArgumentResolver.class);
    assertThat(next(resolvers, index).getClass()).isEqualTo(ModelMethodArgumentResolver.class);
    assertThat(next(resolvers, index).getClass()).isEqualTo(ServerWebExchangeMethodArgumentResolver.class);
    assertThat(next(resolvers, index).getClass()).isEqualTo(PrincipalMethodArgumentResolver.class);
    assertThat(next(resolvers, index).getClass()).isEqualTo(WebSessionMethodArgumentResolver.class);
    assertThat(next(resolvers, index).getClass()).isEqualTo(ContinuationHandlerMethodArgumentResolver.class);
    assertThat(next(resolvers, index).getClass()).isEqualTo(CustomArgumentResolver.class);
    assertThat(next(resolvers, index).getClass()).isEqualTo(CustomSyncArgumentResolver.class);
    assertThat(next(resolvers, index).getClass()).isEqualTo(RequestParamMethodArgumentResolver.class);
}
Also used : InvocableHandlerMethod(org.springframework.web.reactive.result.method.InvocableHandlerMethod) SyncInvocableHandlerMethod(org.springframework.web.reactive.result.method.SyncInvocableHandlerMethod) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) HandlerMethodArgumentResolver(org.springframework.web.reactive.result.method.HandlerMethodArgumentResolver) SyncHandlerMethodArgumentResolver(org.springframework.web.reactive.result.method.SyncHandlerMethodArgumentResolver) ResponseStatusException(org.springframework.web.server.ResponseStatusException) Test(org.junit.jupiter.api.Test)

Aggregations

HandlerMethodArgumentResolver (org.springframework.web.reactive.result.method.HandlerMethodArgumentResolver)6 Test (org.junit.jupiter.api.Test)4 SyncHandlerMethodArgumentResolver (org.springframework.web.reactive.result.method.SyncHandlerMethodArgumentResolver)4 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)3 InvocableHandlerMethod (org.springframework.web.reactive.result.method.InvocableHandlerMethod)3 SyncInvocableHandlerMethod (org.springframework.web.reactive.result.method.SyncInvocableHandlerMethod)3 ArrayList (java.util.ArrayList)2 RequestMappingHandlerAdapter (org.springframework.web.reactive.result.method.annotation.RequestMappingHandlerAdapter)2 List (java.util.List)1 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)1 ConfigurableListableBeanFactory (org.springframework.beans.factory.config.ConfigurableListableBeanFactory)1 Bean (org.springframework.context.annotation.Bean)1 ResponseStatusException (org.springframework.web.server.ResponseStatusException)1