Test that ConnectionFactoryUnwrapper works without pooled-jms jar
Closes gh-41583
This commit is contained in:
parent
88480664d7
commit
c38adaedc2
|
@ -20,8 +20,10 @@ import jakarta.jms.ConnectionFactory;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.messaginghub.pooled.jms.JmsPoolConnectionFactory;
|
import org.messaginghub.pooled.jms.JmsPoolConnectionFactory;
|
||||||
|
|
||||||
|
import org.springframework.boot.testsupport.classpath.ClassPathExclusions;
|
||||||
import org.springframework.jms.connection.CachingConnectionFactory;
|
import org.springframework.jms.connection.CachingConnectionFactory;
|
||||||
import org.springframework.jms.connection.SingleConnectionFactory;
|
import org.springframework.jms.connection.SingleConnectionFactory;
|
||||||
|
import org.springframework.util.ClassUtils;
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
import static org.mockito.Mockito.mock;
|
import static org.mockito.Mockito.mock;
|
||||||
|
@ -79,4 +81,13 @@ class ConnectionFactoryUnwrapperTests {
|
||||||
assertThat(ConnectionFactoryUnwrapper.unwrap(secondPooledConnectionFactory)).isSameAs(connectionFactory);
|
assertThat(ConnectionFactoryUnwrapper.unwrap(secondPooledConnectionFactory)).isSameAs(connectionFactory);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@ClassPathExclusions("pooled-jms-*")
|
||||||
|
void unwrapWithoutJmsPoolOnClasspath() {
|
||||||
|
assertThat(ClassUtils.isPresent("org.messaginghub.pooled.jms.JmsPoolConnectionFactory", null)).isFalse();
|
||||||
|
ConnectionFactory connectionFactory = mock(ConnectionFactory.class);
|
||||||
|
assertThat(ConnectionFactoryUnwrapper.unwrap(new CachingConnectionFactory(connectionFactory)))
|
||||||
|
.isSameAs(connectionFactory);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue