Add missing close

This commit is contained in:
Stephane Nicoll
2014-10-29 15:44:53 +01:00
parent ccc5e65779
commit 429da743f5
2 changed files with 18 additions and 2 deletions

View File

@@ -16,6 +16,7 @@
package org.springframework.boot.autoconfigure.amqp;
import org.junit.After;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
@@ -49,11 +50,18 @@ import static org.mockito.Mockito.verify;
*/
public class RabbitAutoConfigurationTests {
private AnnotationConfigApplicationContext context;
@Rule
public ExpectedException thrown = ExpectedException.none();
private AnnotationConfigApplicationContext context;
@After
public void close() {
if (this.context != null) {
this.context.close();
}
}
@Test
public void testDefaultRabbitConfiguration() {
load(TestConfiguration.class);

View File

@@ -20,6 +20,7 @@ import javax.jms.ConnectionFactory;
import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.activemq.pool.PooledConnectionFactory;
import org.junit.After;
import org.junit.Test;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;
@@ -54,6 +55,13 @@ public class JmsAutoConfigurationTests {
private AnnotationConfigApplicationContext context;
@After
public void close() {
if (this.context != null) {
this.context.close();
}
}
@Test
public void testDefaultJmsConfiguration() {
load(TestConfiguration.class);