diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/activemq/ActiveMQAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/activemq/ActiveMQAutoConfigurationTests.java index 31f510512d..5572bac2c7 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/activemq/ActiveMQAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/activemq/ActiveMQAutoConfigurationTests.java @@ -19,8 +19,10 @@ package org.springframework.boot.autoconfigure.jms.activemq; import javax.jms.ConnectionFactory; import org.apache.activemq.ActiveMQConnectionFactory; +import org.apache.activemq.pool.PooledConnectionFactory; import org.junit.Test; import org.springframework.boot.autoconfigure.jms.JmsAutoConfiguration; +import org.springframework.boot.test.EnvironmentTestUtils; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -57,15 +59,25 @@ public class ActiveMQAutoConfigurationTests { assertTrue(mockingDetails(this.context.getBean(ConnectionFactory.class)).isMock()); } - private void load(Class config) { - this.context = doLoad(config); + @Test + public void pooledConnectionFactoryConfiguration() { + load(EmptyConfiguration.class, "spring.activemq.pooled:true"); + ConnectionFactory connectionFactory = this.context + .getBean(ConnectionFactory.class); + assertThat(connectionFactory, instanceOf(PooledConnectionFactory.class)); + } + + private void load(Class config, String... environment) { + this.context = doLoad(config, environment); } - private AnnotationConfigApplicationContext doLoad(Class config) { + private AnnotationConfigApplicationContext doLoad(Class config, + String... environment) { AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext(); applicationContext.register(config); applicationContext.register(ActiveMQAutoConfiguration.class, JmsAutoConfiguration.class); + EnvironmentTestUtils.addEnvironment(applicationContext, environment); applicationContext.refresh(); return applicationContext; }