Search in sources :

Example 11 with HandlerMethod

use of org.springframework.messaging.handler.HandlerMethod in project spring-framework by spring-projects.

the class SimpAnnotationMethodMessageHandlerTests method exceptionAsCause.

@Test
public void exceptionAsCause() {
    Message<?> message = createMessage("/pre/illegalStateCause");
    this.messageHandler.registerHandler(this.testController);
    this.messageHandler.handleMessage(message);
    assertThat(this.testController.method).isEqualTo("handleExceptionWithHandlerMethodArg");
    HandlerMethod handlerMethod = (HandlerMethod) this.testController.arguments.get("handlerMethod");
    assertThat(handlerMethod).isNotNull();
    assertThat(handlerMethod.getMethod().getName()).isEqualTo("illegalStateCause");
}
Also used : HandlerMethod(org.springframework.messaging.handler.HandlerMethod) Test(org.junit.jupiter.api.Test)

Aggregations

HandlerMethod (org.springframework.messaging.handler.HandlerMethod)11 Test (org.junit.jupiter.api.Test)3 Nullable (org.springframework.lang.Nullable)3 Method (java.lang.reflect.Method)2 LinkedHashMap (java.util.LinkedHashMap)2 Map (java.util.Map)2 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)2 ApplicationContext (org.springframework.context.ApplicationContext)2 MessagingAdviceBean (org.springframework.messaging.handler.MessagingAdviceBean)2 ArrayList (java.util.ArrayList)1 CopyOnWriteArrayList (java.util.concurrent.CopyOnWriteArrayList)1 CompositeMessageCondition (org.springframework.messaging.handler.CompositeMessageCondition)1 DestinationPatternsMessageCondition (org.springframework.messaging.handler.DestinationPatternsMessageCondition)1 AbstractExceptionHandlerMethodResolver (org.springframework.messaging.handler.invocation.AbstractExceptionHandlerMethodResolver)1 LinkedMultiValueMap (org.springframework.util.LinkedMultiValueMap)1 MultiValueMap (org.springframework.util.MultiValueMap)1 RouteMatcher (org.springframework.util.RouteMatcher)1