Search in sources :

Example 26 with StubTextMessage

use of org.springframework.jms.StubTextMessage in project spring-framework by spring-projects.

the class SimpleJmsHeaderMapperTests method userDefinedPropertyWithUnsupportedType.

@Test
public void userDefinedPropertyWithUnsupportedType() throws JMSException {
    Destination destination = new Destination() {
    };
    Message<String> message = initBuilder().setHeader("destination", destination).build();
    jakarta.jms.Message jmsMessage = new StubTextMessage();
    mapper.fromHeaders(message.getHeaders(), jmsMessage);
    Object value = jmsMessage.getObjectProperty("destination");
    assertThat(value).isNull();
}
Also used : Destination(jakarta.jms.Destination) StubTextMessage(org.springframework.jms.StubTextMessage) Test(org.junit.jupiter.api.Test)

Aggregations

StubTextMessage (org.springframework.jms.StubTextMessage)26 Test (org.junit.jupiter.api.Test)21 Session (jakarta.jms.Session)14 Destination (jakarta.jms.Destination)10 TextMessage (jakarta.jms.TextMessage)9 MessagingMessageListenerAdapter (org.springframework.jms.listener.adapter.MessagingMessageListenerAdapter)8 JMSException (jakarta.jms.JMSException)3 Message (jakarta.jms.Message)3 QueueSender (jakarta.jms.QueueSender)2 Assertions.assertThatIllegalStateException (org.assertj.core.api.Assertions.assertThatIllegalStateException)2 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)2 ProxyFactory (org.springframework.aop.framework.ProxyFactory)2 MessageConverter (org.springframework.jms.support.converter.MessageConverter)2 Message (org.springframework.messaging.Message)2 MessageFormatException (jakarta.jms.MessageFormatException)1 MessageNotWriteableException (jakarta.jms.MessageNotWriteableException)1 ObjectMessage (jakarta.jms.ObjectMessage)1 Writer (java.io.Writer)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1