@Test void handleReturnValue_withNullReturnValue_NoMessageTemplateIsCalled() throws Exception { Method validSendToMethod = this.getClass().getDeclaredMethod("validSendToMethod"); MethodParameter methodParameter = new MethodParameter(validSendToMethod, -1); SendToHandlerMethodReturnValueHandler sendToHandlerMethodReturnValueHandler; sendToHandlerMethodReturnValueHandler = new SendToHandlerMethodReturnValueHandler( this.messageTemplate); sendToHandlerMethodReturnValueHandler.handleReturnValue(null, methodParameter, MessageBuilder.withPayload("Nothing").build()); verify(this.messageTemplate, times(0)).convertAndSend(anyString(), anyString()); }
@SuppressWarnings("ConstantConditions") @Override public void handleReturnValue(Object returnValue, MethodParameter returnType, Message<?> message) throws Exception { Assert.state(this.messageTemplate != null, "A messageTemplate must be set to handle the return value."); if (returnValue != null) { if (getDestinationName(returnType) != null) { this.messageTemplate.convertAndSend(getDestinationName(returnType), returnValue); } else { this.messageTemplate.convertAndSend(returnValue); } } }
SendToHandlerMethodReturnValueHandler implements HandlerMethodReturnValueHandler, BeanFactoryAware { @SuppressWarnings("ConstantConditions") @Override public void handleReturnValue(Object returnValue, MethodParameter returnType, Message<?> message) throws Exception { Assert.state(this.messageTemplate != null, "A messageTemplate must be set to handle the return value."); if (returnValue != null) { if (getDestinationName(returnType) != null) { this.messageTemplate.convertAndSend(getDestinationName(returnType), returnValue); } else { this.messageTemplate.convertAndSend(returnValue); } } } }
SendToHandlerMethodReturnValueHandler implements HandlerMethodReturnValueHandler, BeanFactoryAware { @SuppressWarnings("ConstantConditions") @Override public void handleReturnValue(Object returnValue, MethodParameter returnType, Message<?> message) throws Exception { Assert.state(this.messageTemplate != null, "A messageTemplate must be set to handle the return value."); if (returnValue != null) { if (getDestinationName(returnType) != null) { this.messageTemplate.convertAndSend(getDestinationName(returnType), returnValue); } else { this.messageTemplate.convertAndSend(returnValue); } } } SendToHandlerMethodReturnValueHandler(
			DestinationResolvingMessageSendingOperations<?> messageTemplate); }
SendToHandlerMethodReturnValueHandler implements HandlerMethodReturnValueHandler, BeanFactoryAware { @SuppressWarnings("ConstantConditions") @Override public void handleReturnValue(Object returnValue, MethodParameter returnType, Message<?> message) throws Exception { Assert.state(this.messageTemplate != null, "A messageTemplate must be set to handle the return value."); if (returnValue != null) { if (getDestinationName(returnType) != null) { this.messageTemplate.convertAndSend(getDestinationName(returnType), returnValue); } else { this.messageTemplate.convertAndSend(returnValue); } } } SendToHandlerMethodReturnValueHandler(
			DestinationResolvingMessageSendingOperations<?> messageTemplate); @Override boolean supportsReturnType(MethodParameter returnType); @SuppressWarnings("ConstantConditions") @Override void handleReturnValue(Object returnValue, MethodParameter returnType,
			Message<?> message); @Override void setBeanFactory(BeanFactory beanFactory); }
SendToHandlerMethodReturnValueHandler implements HandlerMethodReturnValueHandler, BeanFactoryAware { @SuppressWarnings("ConstantConditions") @Override public void handleReturnValue(Object returnValue, MethodParameter returnType, Message<?> message) throws Exception { Assert.state(this.messageTemplate != null, "A messageTemplate must be set to handle the return value."); if (returnValue != null) { if (getDestinationName(returnType) != null) { this.messageTemplate.convertAndSend(getDestinationName(returnType), returnValue); } else { this.messageTemplate.convertAndSend(returnValue); } } } SendToHandlerMethodReturnValueHandler(
			DestinationResolvingMessageSendingOperations<?> messageTemplate); @Override boolean supportsReturnType(MethodParameter returnType); @SuppressWarnings("ConstantConditions") @Override void handleReturnValue(Object returnValue, MethodParameter returnType,
			Message<?> message); @Override void setBeanFactory(BeanFactory beanFactory);  }