use of jakarta.jms.ObjectMessage in project spring-framework by spring-projects.
the class SimpleMessageConverterTests method testSerializableConversion.
@Test
public void testSerializableConversion() throws JMSException {
Session session = mock(Session.class);
ObjectMessage message = mock(ObjectMessage.class);
Integer content = 5;
given(session.createObjectMessage(content)).willReturn(message);
given(message.getObject()).willReturn(content);
SimpleMessageConverter converter = new SimpleMessageConverter();
Message msg = converter.toMessage(content, session);
assertThat(converter.fromMessage(msg)).isEqualTo(content);
}
Aggregations